判断sql执行所花的时间(精度为毫秒)

 
DECLARE @begin datetime
DECLARE @chaju bigint
DECLARE @end datetime
SET @begin=getdate()

要执行的sql语句......

SET @end=getdate()       
SELECT @chaju = datediff(Millisecond, @begin@end)
PRINT @chaju 
原文地址:https://www.cnblogs.com/redfox241/p/927410.html