SQL conversion of a char data type to a datetime data type error
From Jonsdocswiki
Contents |
Symptoms
When attempting to process data in a SQL database the user is presented with the following error:
| SQL Conversion of data types error |
|
[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.
database messages when reading data:
|
Cause
If the language setting for the user is set differently to the default language of the SQL database this can occur. For example, by default the database uses US English and if a user's language is set to British English this can cause a problem with dates. (Americans write MM/DD/yyyy whereas in England this is written DD/MM/YYYY).
Fix
Change the user's language setting:
- Open the SQL Enterprise Manager
- Connect to your SQL database server and expand the server details to show the security option in the left hand pane.
- Select logins and right click the user in question - click properties.
- At the bottom of this window change the Language drop down to match the server setting (or choose default).
- Click OK and retry the connection and data processing.
