Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Hello..This is a question about DATEADD function.This is from sql server 2005Why does the first sql statement return an error? They are identical sans the unix timestamp..select dateadd(ss,2359934342,'01/01/1970')result: Arithmetic overflow error converting expression to data type int.But this one returns a date as expectedselect dateadd(ss,1078576968,'01/01/1970')result: 2004-03-06 12:42:48.000thanks for any feedback..r&r
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts
Posted - 2009-01-07 : 18:29:26
The error message you got tells you exactly what the problem is:you cannot convert the number 2359934342 to a datatype of integer.The largest possible value for datatype integer is 2147483647.This code should do what you want: