I want to display the results of a select from within a while loop in SQL.
The code works, but unlike using the same select outside of the while loop, it doesn't display any results.
Is this possible?
This is my code.... nothing fancy at all....
declare @flag INT
set @flag = 0
while (@flag <12)
select count(*) from dbo.queue
waitfor delay '0:5:0'
set @ flag = (@flag + 1)
The intention -- get a count of records from the table Queue (display them),
wait 5 minutes, go do it again....until the loop expires.
code works -- just displays everything at the end.... I want it to display during each cycle of the loop.