ITPub博客

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

原创 作者: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
请登录后发表评论 登录
全部评论

注册时间:2009-04-22

  • 博文量
    272
  • 访问量
    2161816