BUG: Error Handler Not Called by RAISERROR if NOCOUNT Set ON (152135)



The information in this article applies to:

  • Microsoft SQL Server 4.2x
  • Microsoft SQL Server 6.0
  • Microsoft SQL Server 6.5

This article was previously published under Q152135

SYMPTOMS

When executing a stored procedure that raises an error through RAISERROR, the error handler in the DB-Library application is not called if NOCOUNT is set ON within the stored procedure. The message handler is always called correctly, but the calling of the error handler depends on the NOCOUNT behavior.

WORKAROUND

Set NOCOUNT OFF before calling the RAISERROR in the stored procedure, and then set NOCOUNT back ON after the RAISERROR.

STATUS

Microsoft has confirmed this to be a problem in Microsoft SQL Server versions 6.5, 6.0 and 4.21a. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

Modification Type:MajorLast Reviewed:11/14/2003
Keywords:kbBug KB152135