SQL – Conversion of char to datetime error
Whilst I was deploying a web site yesterday for a client I ran into a problem. After deploying to the client server and them restoring the database to their SQL server, every login resulted in an error whilst trying to insert an audit record of the login.
Error Executing Database Query.
[Macromedia][SQLServer JDBC Driver][SQLServer]The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.
The error was regarding converting a char to a datetime field. Now this code ran just fine on our servers, we checked everything, from regional settings, locales etc – to cut a long story short it turned out that the SQL user the client had created for us to use had it’s default language set to ‘British English’ instead of ‘English’ – switching it to English it all started working fine – probably not something the majority would run into but posting it here for prosperity
No related posts.


