关于 两个 datetime 列的差别导致了运行时溢出

当在存储过程里使用了datediff函数进行日期减法操作的时,要返回之间的秒数,有可能就会产生溢出

返回的秒数长度已经超过了类型长度

declare @start Datetime
declare @end datetime
set @start = '2010-10-10'
set @end = '2099-10-10'
select DATEDIFF(ss,@start,@end)

------------------------------------

消息 535,级别 16,状态 0,第 5 行
两个 datetime 列的差别导致了运行时溢出。

 

posted @ 2010-06-25 10:26  死 神  阅读(1762)  评论(0编辑  收藏  举报