Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm currently importing a table from MYSQL to MSSQL. There's a column there for storing date, only it's stored as an number. When i import it to MSSQL i get it in as an int data type.

When i try to convert that to datetime I get an :

Arithmetic overflow error converting expression to data type datetime.

Since i'm using MSSQL 2005 I can't use datetime2 and fit it so it does not overflow.

Is there a way to trim that date stored as an int so it does not overflow the datetime format ?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

The MSSQL datetime data type can take values from January 1, 1753 to December 31, 9999. The integer equivalents for those values are -53690 and 2958463 respectively. Trying to convert integer values outside that range would cause the arithmetic overflow.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.