欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

返回SQL执行时间的存储过程

程序员文章站 2022-05-24 22:47:15
...

返回任何SQL执行时间(到毫秒,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 水费表 where 费用ID
相关标签: SQL 执行时间