DATEDIFF() 函数返回两个日期之间的时间
DATEDIFF(datepart,startdate,enddate):返回两个日期之间的时间
SELECT DATEDIFF(day,'2008-12-29','2008-12-30') AS DiffDate
在做合同预警时,对比合同终止日期和当前日期进行日期差,时间提前60天预警
DATEDIFF(DAY,htzzr,GETDATE()) as SYTS,
DATEDIFF(DAY,HTQSR,GETDATE()) as TQTS