返回SQL执行时间的存储过程
程序员文章站
2023-11-29 09:45:40
复制代码 代码如下: use nbdxmis create proc testtimeanysentence @sql_where varchar(8000) as dec...
复制代码 代码如下:
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<200000'