日期:2014-05-18 浏览次数:20509 次
declare @dt as datetime set @dt = '2011-09-21 10:17:39.993' select dateadd(ms,100,@dt) /* ------------------------------------------------------ 2011-09-21 10:17:40.093 (所影响的行数为 1 行) */ select convert(varchar(19),dateadd(ms,100,@dt),120) /* ------------------- 2011-09-21 10:17:40 (所影响的行数为 1 行) */
------解决方案--------------------
declare @t1 datetime set @t1='2011-09-21 10:17:39.993' declare @t2 datetime set @t2='2011-09-21 10:17:40.001' --10:17:40.000 或 10:17:40.001 select datediff(ms,@t1,@t2) /* 6 */ --@t2为10:17:40.000 或 10:17:40.001时,结果都为6,原因大乌龟已经说过了。