Changing the date format
Remember that SQL Server can interpret character strings that look like dates in a different way than you would expect.
Depending on your settings, the string "29-04-2019" could be interpreted as the 29th of April, or an error can be thrown that the conversion to a date was not possible.
In the first situation, SQL Server expects a day-month-year format, while in the second, it probably expects a month-day-year and the 29th month does not exist.
In this exercise, you will instruct SQL Server what kind of date format you want to use.
Bu egzersiz
Functions for Manipulating Data in SQL Server
kursunun bir parçasıdırUygulamalı interaktif egzersiz
Bu örnek kodu tamamlayarak bu egzersizi bitirin.
DECLARE @date1 NVARCHAR(20) = '2018-30-12';
-- Set the date format and check if the variable is a date
SET DATEFORMAT ___;
SELECT ___(@date1) AS result;