日期:2014-05-18 浏览次数:20723 次
declare @date datetime,@getdate datetime,
@h int, --小时
@m int, --分
@s int, --秒
@ms int --毫秒
select @getdate=getdate(),@date='2007-10-1'
select @h=datepart(hh,@getdate),@m=datepart(n,@getdate),@s=datepart(s,@getdate),@ms=datepart(ms,@getdate)
select @getdate as 当前时间,dateadd(ms,@ms,dateadd(s,@s,dateadd(n,@m,dateadd(hh,@h,@date)))) as 计算时间
当前时间 计算时间
------------------------------------------------------ ------------------------------------------------------
2007-10-18 20:38:43.043 2007-10-01 20:38:43.043
(所影响的行数为 1 行)