返回SQL執(zhí)行時間的存儲過程

返回任何SQL執(zhí)行時間(到毫秒,sql 2000)

代碼如下:
USE NBDXMIS
CREATE proc TestTimeAnySentence
@sql_where varchar(8000)
as
declare @ct datetime
set @ct = getdate()
declare @newsql_where varchar(8000)
set @newsql_where=@sql_where
exec(@newsql_where)
select datediff(ms, @ct ,getdate()) as ‘查詢時間(毫秒)’
go
TestTimeAnySentence ‘select * from 水費(fèi)表 where 費(fèi)用ID

? 版權(quán)聲明
THE END
喜歡就支持一下吧
點(diǎn)贊8 分享