CJSmith dot me

I dump stuff I find useful here

Force TSQL dateformat

Published / by Chris Smith / Leave a Comment

If you get the following error on scheduled stored procedures, force the dateformat (The Microsoft SQL Server scheduler will probably be running the default mdy), you can use Set Language but I tend to change the dateformat.
[SQLSTATE 01000] (Message 0) The conversion of a nvarchar data type to a datetime data type resulted in an out-of-range value. [SQLSTATE 22007] (Error 242) The statement has been terminated.

As I am in the UK we tend to use dmy

Microsoft Docs

Leave a Reply