要在t-sql中写一个无限循环的子程序
但是找不到类似C#中的sleep语句,后来查找到,可以使用以下语句waitfor语句来实现这样的功能
Code
create procedure time_delay2 @delaylength char(9)
as
declare @returninfo varchar(255)
begin
waitfor delay @delaylength
select @returninfo = 'a total time of ' +
substring(@delaylength, 1, 3) +
' hours, ' +
substring(@delaylength, 5, 2) +
' minutes, and ' +
substring(@delaylength, 8, 2) +
' seconds, ' +
'has elapsed! your time is up.'
print @returninfo
end
go