I have some doubts about SET DATEFORMAT command.
1)Does this command is only used for inserting and updating date format and it does not effect the date format of that column? OR does this effect my table after inserting values too?
2) I tried using below command(for date datatype) and got error like
This session's YDM date format is not supported when converting from this character string format to date, time, datetime2 or datetimeoffset. Change the session's date format or provide a style to the explicit conversion.
. why the error comes for date datatype(where as for smalldatetime it works as shown in link)?
CREATE TABLE #tempTable (DateFormatSample DATE) SET DATEFORMAT MDY INSERT INTO #tempTable VALUES ('09/28/2007') SET DATEFORMAT YDM INSERT INTO #tempTable VALUES ('2007/28/09') SET DATEFORMAT YMD INSERT INTO #tempTable VALUES ('2007/08/28') SELECT DateFormatSample FROM #tempTable DROP TABLE #tempTable
3)It was mentioned like "The setting of SET DATEFORMAT is set at execute or run time and not at parse time." What does it mean?