ITPub博客

使用waitfor time和waitfor delay在一定时间间隔下定时执行批处理

原创 IT综合 作者:kitesky 时间:2013-08-22 14:29:34 0 删除 编辑
使用waitfor time和waitfor delay[@more@]
[case 1]
WAITFOR TIME '01:20:04'
begin
declare @i int = 0
while (@i < 3)
begin
insert into ContentType_Log(TypeID,TypeName,LastUpdateDate)
select TypeID,TypeName,getdate() as LastUpdateDate
from TypeTable
set @i = @i + 1
WAITFOR DELAY '00:00:10'
end
end
GO
[case 2]
WAITFOR TIME '01:23:34'
GO
begin
insert into ContentType_Log(TypeID,TypeName,LastUpdateDate)
select TypeID,TypeName,getdate() as LastUpdateDate
from TypeTable
WAITFOR DELAY '00:00:10'
end
GO 3

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/66009/viewspace-1060870/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2009-04-22

  • 博文量
    273
  • 访问量
    2162635