针对sqlserver的,应用了datediff的函数
declare @ct datetime
set @ct = getdate()
---
--sql 语句
---
select datediff(ms, @ct ,getdate()) as '查询时间(毫秒)'
declare @ct datetime
set @ct = getdate()
---
--sql 语句
---
select datediff(ms, @ct ,getdate()) as '查询时间(毫秒)'
本文介绍了一种在SQL Server中使用datediff函数来计算两个时间点之间差异的方法。通过声明一个变量并设置其为当前时间,然后使用datediff计算当前时间和获取到的新时间之间的毫秒数差异。
1万+

被折叠的 条评论
为什么被折叠?



