declare @Date datetime set @Date=getdate() exec p1-存儲過程 select datediff(millisecond,@Date,Getdate())
set @dd=getdate() //... set @dd=datediff(ms,@dd,getdate())
select datepart(ms , getdate())/*
----------- 700(所影响的行数为 1 行) */
DATEPART 返回代表指定日期的指定日期部分的整数。语法 DATEPART ( datepart , date ) 参数 datepart是指定应返回的日期部分的参数。下表列出了 Microsoft® SQL Server™ 识别的日期部分和缩写。日期部分 缩写 year yy, yyyy quarter qq, q month mm, m dayofyear dy, y day dd, d week wk, ww weekday dw Hour hh minute mi, n second ss, s millisecond ms --豪秒
执行计划里面有执行时间 或者 declare @Date datetime set @Date=getdate() 执行语句select datediff(ms,@Date,Getdate())
declare @bdate smalldatetime Set @date=getdate() exec your procedure Select datediff(ms,@bdate ,getdate())
正解啊,我也来一段,攒点热心度啊!dbcc dropcleanbuffers declare @Date datetime set @Date=getdate() select * from product where name like '%篮球%'select cast( datediff(millisecond,@Date,Getdate()) as varchar(10)) +'毫秒'
開始用getdate賦值
結束計算花費的秒數
declare @Date datetime
set @Date=getdate() exec p1-存儲過程 select datediff(millisecond,@Date,Getdate())
//...
set @dd=datediff(ms,@dd,getdate())
-----------
700(所影响的行数为 1 行)
*/
返回代表指定日期的指定日期部分的整数。语法
DATEPART ( datepart , date ) 参数
datepart是指定应返回的日期部分的参数。下表列出了 Microsoft® SQL Server™ 识别的日期部分和缩写。日期部分 缩写
year yy, yyyy
quarter qq, q
month mm, m
dayofyear dy, y
day dd, d
week wk, ww
weekday dw
Hour hh
minute mi, n
second ss, s
millisecond ms --豪秒
执行计划里面有执行时间
或者
declare @Date datetime
set @Date=getdate() 执行语句select datediff(ms,@Date,Getdate())
declare @bdate smalldatetime
Set @date=getdate()
exec your procedure
Select datediff(ms,@bdate ,getdate())
正解啊,我也来一段,攒点热心度啊!dbcc dropcleanbuffers
declare @Date datetime
set @Date=getdate() select * from product where name like '%篮球%'select cast( datediff(millisecond,@Date,Getdate()) as varchar(10)) +'毫秒'