How do I write a message to the Message tab in SQL Server 2005 query analyzer? PRINT statements are all queued up and don’t show up until the entire script is printed. Is there a FLUSH statement of some sort to output the print queue?
There isn’t a flush statement. However, there is an alternative to PRINTing your messages. You can raise an error that isn’t really an error (code of 0) and you’ll get the same effect–your message will be printed immediately.
Here’s the statement:
Pretty soon, you’ll be raising fake errors all over the place and getting the results you want. Sure, it’s a hack but it works great.
Let me know if it works for you!