Error: The conversion of char data type to smalldatetime...
iposner
Posts: 6
"The conversion of char data type to smalldatetime data type resulted in an out-of-range smalldatetime value."
SQL 2005, British English connection using SQL Data Compare 7.1.0.245.
Changing my default language to English makes the problem go away.
Looks like it's that old chestnut of coding with US date format strings rather than ISO format strings (yyyymmdd) which would make the problem go away...
SQL 2005, British English connection using SQL Data Compare 7.1.0.245.
Changing my default language to English makes the problem go away.
Looks like it's that old chestnut of coding with US date format strings rather than ISO format strings (yyyymmdd) which would make the problem go away...
Ian Posner
Director
MindQuest Solutions Ltd
Director
MindQuest Solutions Ltd
Comments
I'm disapointed that the tool can't cope with non-US date formats.
The problem may be an incompatibility between the date format returned by SQL Server being misinterpreted when converted to a .NET DateTime type.
I'll see if I can get a clear answer on this from our development team.
We definitely don't force you to use a US datetime format, or we couldn't use our own software as we are a UK company!
Most people don't realise it - regardless of the local workstation settings, they connect to SQL Server using the default English (US) language, so don't experience the problem.
Director
MindQuest Solutions Ltd
Also, is this happening during comparison or synchronization of data?
I am generating the scripts from data compare, but then pasting these scripts into our own rollout tool (which runs sqlcmd).
So the scripts are being created in us_english, but then when they are run against the target database they are being run using the language of british (which our db is set to use).
As a workaround I am now setting the language to us_english at the begining of the script, and then back again at the end.
I think it would make scense if there was an option to "Use the database language" or "Specify language". If a language is specified then it should also be included in the script output to ensure it runs correctly.
Thanks
SET LANGUAGE us_English
at the top of the SQL Script that Data Compare produces, or to actually change the language on the server?
At the top of the sql script that data compare produces.
And then set it back to british at the bottom of the script
One of our managers will evaluate the request and put it in the product if it solves these problems and there isn't a better way of doing it.