When I use PRINT statements to debug and monitor long running queries in SQL Server Management Studio, I notice that the output does not appear in the Messages tab right away. Is there a way to flush output to the message tab, or to set up the environment so that it doesn't buffer messages?
Asked
Active
Viewed 5,332 times
1
-
possible duplicate of http://stackoverflow.com/questions/306945/how-do-i-flush-the-print-buffer-in-tsql – Adriaan Stander Apr 21 '10 at 17:16
1 Answers
5
Use RAISERROR with NOWAIT instead of PRINT http://www.mssqltips.com/tip.asp?tip=1660

Martin Smith
- 438,706
- 87
- 741
- 845
-
1This seems like the duplicate http://stackoverflow.com/questions/306945/how-do-i-flush-the-print-buffer-in-tsql – Adriaan Stander Apr 21 '10 at 17:58
-
-
Works like a charm, thanks. Not sure why couldn't find 306945 when I first searched for this, although I notice that the first 50 relevant results in a search for "SQL Print Flush" doesn't find this reference. May I ask how you found the original post? – Paul Keister Apr 29 '10 at 16:34