To get an inventory of available languages, query syslanguages.įor our specific use-case, we are only interested in US and British English. Here is the code line for changing our Login's language to British English. Output: Permanent Fix In our case, our permanent fix will be to create a dedicated Login for our application and assign an European language to it. Select cast(CONVERT(NVARCHAR(10), getdate(), 105) as datetime) set session's date format to dmy (day-month-year = european) Let us put in a temporarily fix for this session, by issuing a “ set dateformat dmy ” Where session_id = it appears we have a mismatch between the code which is expecting to get back a date formatted for 105 (dmy), European, and my SQL Server’s login\session default of mdy. Next question is why is 105 (passed as the style argument) ? A nswerįrom Cast and Convert – Transact SQL ( ), here are the “Date Format Styles”:Ĭrediting Scott Munro – “Setting and resetting the DATEFORMAT in SQLServer 2005″( ) Select cast(convert(nvarchar(10), getdate(), 105) as datetime) as startTime
Error Message Error Message Msg 242, Level 16, State 3, Line 26 The conversion of a nvarchar data type to a datetime data type resulted in an out-of-range value.