Using the NOWAIT option with the SQL Server RAISERROR statement instead of PRINT

Using the NOWAIT option with the SQL Server RAISERROR statement:

Problem T-SQL scripts and stored procedures don’t produce their PRINT statements and RAISERROR output in a way that keeps you informed of the code’s progress. You usually have to wait until the procedure is complete before seeing messages. How can I get insight into the code's progress?
Solution
The solution is to use the WITH NOWAIT clause of the RAISERROR statement" It may be surprising but using RAISERROR doesn’t require that there is an error condition. If the severity level given to RAISERROR is 0 through 10 SQL Server treats the RAISERROR as a plain message and not an error at all. Execution continues with the next statement, even if there is a TRY/CATCH block or if SET XACT_ABORT is ON. Use the combination of a RAISERROR severity of 0 to 10 and the WITH NOWAIT clause for a statement that sends output to the Messages windows immediately.

i.e       RAISERROR ('Now that’'s what I call a message!', 0, 1) WITH NOWAIT

Comments

Popular posts from this blog

Cannot fetch a row using a bookmark from OLE DB provider 'OraOLEDB.Oracle

Manual de alarma Chevrolet

http://www.colombiasoyyo.org