Go homepage(回首页)
Upload pictures (上传图片)
Write articles (发文字帖)

The author:(作者)归海一刀
published in(发表于) 2014/2/1 0:21:02
得出SQL语句的执行时间的方法_[SQL,Server教程]

得出SQL语句的执行时间的方法_[SQL Server教程]

在网上找的:



--SQL语句前加:
declare @d datetime
set @d=getdate()
--SQL语句
--在SQL语句后加:
select [语句执行花费时间(毫秒)]=datediff(ms,@d,getdate())

这个查询结果不能在查询分析器中直观显示出来,自己改进了一下:


--SQL语句前加:
declare @d datetime
set @d=getdate()
--SQL语句
--在SQL语句后加:
select @d AS '开始时间', getdate() AS '结束时间' , datediff(ms,@d,getdate()) AS '执行时间'

不过这个方法不能对本身耗时很少的查询得出结果。不知有别的什么软件和方法能得出SQL语句的确切的执行时间。





If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)





QQ:154298438
QQ:417480759