Wednesday, March 14, 2007

Waiting in SQL 2005

Have you ever needed to wait in a stored procedure? Well here is how. Declare @Counter as int

Set @Counter = 0 while @Counter < 3 BEGIN print @Counter Set @Counter = @Counter + 1 WAITFOR DELAY '00:00:02' -- waits for 2 seconds before next line is executed. END

1 comment:

electronic signatures said...

I faced this requirement recently that I need to add some wait before executing the next line.I was searching for this and you blog saved me a lot of time and it works fine for me as you defined.Thanks