使用TSQL如何找到两次之间的差异,以毫秒为单位?
declare @start datetime = '2012-04-10 14:59:12.863',
@end datetime = '2012-04-10 14:59:13.800'
select @start, @end, 'TODO: get timespan in milliseconds between @start and @end'
答案 0 :(得分:6)
将datediff函数用作documented here.
declare @start datetime = '2012-04-10 14:59:12.863',
@end datetime = '2012-04-10 14:59:13.800'
select datediff(ms, @start, @end)
ms是datepart缩写,以毫秒为单位。