1

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?

Paul Keister
  • 12,851
  • 5
  • 46
  • 75

1 Answers1

5

Use RAISERROR with NOWAIT instead of PRINT http://www.mssqltips.com/tip.asp?tip=1660

Martin Smith
  • 438,706
  • 87
  • 741
  • 845
  • 1
    This 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
  • Agreed. Same Question, same answer! – Martin Smith Apr 21 '10 at 19:27
  • 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