I have a simple query which loops and I want to see the PRINT messages during the execution. The query is something like this:
WHILE 1 = 1
BEGIN
WAITFOR DELAY '000:00:10'
PRINT 'here'
END
The PRINT 'here' does not output until I stop the process. However, I want to see it while it’s running. Is this possible?
I believe that the prints get buffered, releasing “chunks” as the buffer fills up.
try using raiserror:
How do I flush the PRINT buffer in TSQL?