View Single Post
  #4 (permalink)  
Old 01-06-09, 11:37
tomh53 tomh53 is offline
9th inning DBA
 
Join Date: Jan 2004
Location: In a large office with bad lighting
Posts: 1,036
What is the value of @@ROWCOUNT after the IF (SELECT ... )?

I suspect it is 1, so you would only get 1 row before your @k is > @rows thereby ending your loop.

Try:
Code:
 
select @rows = count(*) 
from dbo.tblActions   
WHERE dbo.tblActions.acti_complete = 0 
   AND COALESCE(dbo.tblActions.acti_due_datetime,getdate()) < GETDATE()
__________________

-- This is all just a Figment of my Imagination --
Reply With Quote