<ins class="adsbygoogle" style="display:inline-block;width:336px;height:280px" data-ad-client="ca-pub-1944176156128447" data-ad-slot="2755181948">ins>

 

有时候我们需要知道一段SQL语句执行的时间有多长。下面是其中一种办法。

 

 

declare @preDate Datetime

select @preDate = getdate()

print @preDate

select datepart(ms,@preDate) as ms, datepart(ss,@preDate) as second,datepart(mi,@preDate) as minute

go

--需要测试的SQL语句

go

declare @preDate Datetime

SELECT @preDate= getdate()

select datepart(ms,@preDate) as ms, datepart(ss,@preDate) as second,datepart(mi,@preDate) as minute

 

这样可以知道你的语句到底运行了多少毫秒。

 

相关文章:

  • 2022-12-23
  • 2021-12-18
  • 2021-07-09
  • 2022-12-23
  • 2022-12-23
  • 2021-06-18
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-01-11
  • 2022-12-23
  • 2022-01-06
  • 2022-02-23
  • 2021-11-30
  • 2021-05-23
相关资源
相似解决方案