Innovative Survey & Feedback Solutions

Phone Contact

Error: 'conversion of a char data type to a datetime'

Article ID: 1005 Posted Date: 6/1/2004 4:40:13 PM
Products: General Updated Date: 6/1/2004 4:40:13 PM

When using SQL server, the following error is displayed:

[Microsoft][ODBC SQL Server Driver][SQL Server]The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.

This is due to an inconsistency in the language settings between the web server and SQL server (or SQL server user). By default, SQL Server users are set to "us_english" as the default language. The result is that different date formats are being used and are therefore not recognized by the database.

There are several options to remedy this situation:

1. Change the SQL user's default language to match the language settings on the SQL server.
To do this, open SQL enterprise manager and connect to your database server. Expand Security -> Logins and open the properties dialog for the user that you are using to connect to the database. On the main properties page, change the language to equal the same language that is set on your web server.

2. Modify your connection string
On your SQL connection string, add a parameter of Language= and set it equal to the correct language. For example, Language=British.