(转)SQLServer_T-SQL 语句执行时间的查询

时间:2021-11-21 15:40:20

  原文地址:http://blog.csdn.net/wangjunhe/article/details/7211974

--利用getdate
declare @beginTime datetime
declare @endTime datetime set @beginTime = getdate()
select * from dbo.DatabaseLog
set @endTime = getDate() select datediff(ms, @beginTime, @endTime) as MS
GO

  

--利用Statistics
set statistics time on select * from dbo.DatabaseLog set statistics time off