Adding a value to a 'datetime' column caused overflow.

Posted by sathya on Geeks with Blogs See other posts from Geeks with Blogs or by sathya
Published on Thu, 22 Apr 2010 18:32:35 GMT Indexed on 2010/04/22 19:13 UTC
Read the original article Hit count: 313

Filed under:

Adding a value to a 'datetime' column caused overflow.

Came across this error today. So thought of posting the same.
Whenever you try to do a dateadd like this 

dateadd(mm,12,datefield)

you might face this error if the value in your records in the datefield is not a valid date or
if u add some months or date to this value and the output of that will exceed the date range

In my case i was just thinking what would be the error here.
But unfortunately there was some data in the table which was there with the value
(Ex:date of joining column)

1-1-9999

So my sql statement has tried to add 12 months to this and it had caused this error.

© Geeks with Blogs or respective owner