MSDN
clearly states that:
The date argument cannot be incremented to a value outside the range of its data type. In the following operations, the numeric value added to the date value exceeds the range of the date data type. The following error message appears: "Adding a value to the" datetime "column caused an overflow."
And an example:
SELECT DATEADD(year,2147483647, '2006-07-31'); SELECT DATEADD(year,-2147483647, '2006-07-31');
which causes the error:
"Adding a value to the 'datetime' column caused an overflow."
That seems right. But why am I getting the same error executing this SQL statement:
SELECT DATEDIFF(YY,'1013-12-12',DATEADD(YY,-300,getdate()))
more specific and only:
SELECT DATEADD(YY,-300,getdate())
gotqn source share