如何用时间相减?
declare @a datetime
set @a= getdate()-b
select @b
b为int型参数,时间为秒...
用什么语句?
------解决方案--------------------declare @a datetime,@b int
set @b =10
set @a= dateadd(mi,@b*-1,getdate())
select @b,@a,getdate()
------解决方案--------------------declare @a datetime
declare @b int
set @b=10
select dateadd(ss,-10,getdate())
------------------------------------------------------
2007-09-08 13:56:54.420
(1 row(s) affected)