sql执行时间

declare @i as int
declare @begintime as datetime
set @begintime = getdate()
set @i = 0

while @i < 100
begin

insert into TestT (title,info,flag) values ('title'+cast(@i as varchar),'info'+cast(ceiling(rand() * 100) as varchar ),ceiling(rand() * 2))
set @i = @i + 1

end

select datediff(ms,@begintime,getdate()) as '執行時間'


原文地址:https://www.cnblogs.com/hanwest/p/2881890.html