Home

BUG: SQL Results not returning results immediately in certain circumstances

Create a new Query window, set the language to SQL, and connect to a MS-SQL Server, and run the following SQL:-
RAISERROR ('You should see this immediately', 0, 1) WITH NOWAIT
SELECT * FROM master.sys.databases
RAISERROR ('You should see this immediately too, along with a table above.', 0, 1) WITH NOWAIT
WAITFOR DELAY '00:00:05'
RAISERROR ('You should see this 5 seconds later...', 0, 1) WITH NOWAIT
The result is that only the first line is returned immediately. The rest only returns at the end of the execution 5 seconds later. This bug only happens when there are table results in the output before a RAISERROR WITH NOWAIT message.

This is an issue if we want to monitor the progress of a long-running SQL script using RAISERROR WITH NOWAIT.

FYI, SSMS has a different issue with regards to this in that it doesn't return RAISERROR WITH NOWAIT messages immediately after the first 500 messages.

Comments

Sign In or Register to comment.