查看SQL语句的执行时间

 方法一:
打开 SQL Server的查询分析器。在下面语句两个go中间加入要执行的 sql语句。
set statistics profile on
set statistics io on
set statistics time on
go
<这里写上你的语句...>
go
set statistics profile off
set statistics io off
set statistics time off

For example:
SET STATISTICS io ON
SET STATISTICS time ON
go
SELECT *   FROM TBL_MeetingRoomOrder
go
SET STATISTICS profile OFF
SET STATISTICS io OFF
SET STATISTICS time OFF
方法二:
select语句前加:
declare @d datetime
set @d=getdate()
并在select语句后加:
select [语句执行花费时间(毫秒)]=datediff(ms,@d,getdate())

你可能感兴趣的:(SQL数据库,statistics,sql,sql,server,io,go)