View Single Post

   
  #1 (permalink)  
Old 02-28-2008, 06:50 PM
Matt
 
Posts: n/a
Default sleep for n seconds

Hi

I am trying to use the WAITFOR function to make each loop in a cursor
occur every 4 seconds until the curdb is empty

the prtocedure is as follows

---------------- start
create procedure q_additionalrabatt
@additionalrabatt float,
@ordernr int

AS

declare @ordradnr int

declare curdb cursor for select ordernr, ordradnr from orp where
ordernr = @ordernr
for read only

open curdb

fetch curdb into @ordernr, @ordradnr

while @@fetch_status = 0
begin

update orp
set orp.rabatt1 = (orp.rabatt1 + @additionalrabatt)
where orp.ordernr = @ordernr and
orp.ordradnr = @ordradnr

fetch curdb into @ordernr, @ordradnr

end

close curdb
deallocate curdb

------------------- end

I need to make sure, that before it fetches the next row it waits 4
seconds before executing the next loop.

Matt
Reply With Quote