数据库
首页 > 数据库> > 返回任何SQL执行时间(到毫秒)

返回任何SQL执行时间(到毫秒)

作者:互联网

 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'

 

标签:返回,set,varchar,毫秒,SQL,newsql,where,select,ct
来源: https://www.cnblogs.com/cdoneiX/p/12258565.html