发表新主题 回复该帖子
主题:如何在查询分析器中显示sql语句的精确执行时间(能精确到ms的)
唧唧
帖子档案  楼主 如何在查询分析器中显示sql语句的精确执行时间(能精确到ms的)   Post by : 2009-08-07 15:10:56.0
  • 幼儿园
  • 幼儿园
  • UID:3
  • 主题:341
  • 帖子:777
  • 加为好友 加为好友    发送短信 发送短信

有时间我们经常要在查询分析器里执行sql语句
在分析执行效率的时候,需要得到精确的时间,以下就能帮你解决这个问题。

declare @time datetime --定义时间变量
set @time = getdate() --给变量赋值

select top 100 * from xx order by xx --执行sql语句

select datediff(ms,@time,getdate()) --显示执行精确时间
或者
print datediff(ms,@time,getdate())

签名
 ★★★★★★★★
 纵里寻她千百度,蓦然回首,那人却在,灯火阑珊处!
 MyBlog :http://blog.javawind.net
返回页面顶部  


CopyRight © 2008-2009 JavaWind.Net Studio All Rights Reserved
Powered By JWind.BBS Vesion 1.0.0 Beta1 Processed in 76 ms,0 (Queries)  Gzip enabled

WAP - 清除Cookies - 联系我们 - JavaWind.Net Studio - Archiver - TOP Valid XHTML 1.0 Transitional Valid CSS! 粤ICP备07511478号