We’ve run into a problem moving an environment from SQL Server 2005 to 2008. Specifically, after we’ve moved the database and run our upgrade code (which includes a DataObjects “perform” schema upgrade), we’re running into errors like this:
The conversion of a datetime2 data type to a datetime data type resulted in an out-of-range value.
I understand that DataObjects uses the datetime2 type available in 2008 by default, and we were a little surprised when the upgrade didn’t migrate the columns from datetime columns to datetime2 columns. It also appears that DataObjects chooses a datatype for querying based on something other than the column’s actual type (i.e. the database version, compatibility settings, or some other metadata), leading to the above error when querying.
Is there a way to prompt the DataObjects schema upgrade to change datetime columns into datetime2 columns? Have we missed a step updating the compatibility level or some other piece of metadata when moving the database to 2008? Should DataObjects continue to work / query correctly if we choose to keep using the old datetime type?
asked Dec 12 '12 at 19:46
Unfortunately DataObjects.Net currently can't distinguish
DataObjects.Net uses server version to determine capabilities of the server. This includes available data types as well as their value ranges. When SQL Server 2008 is used DO starts using
The above statements leave two options for you:
answered Dec 13 '12 at 03:22