Microsoft KB Archive/280099

From BetaArchive Wiki
Knowledge Base


BUG: Transact-SQL Debugger Cannot Debug a Stored Procedure that Contains a RAISERROR Statement that Raises any Error with Severity 16 or Higher

Article ID: 280099

Article Last Modified on 10/3/2003



APPLIES TO

  • Microsoft SQL Server 2000 Standard Edition



This article was previously published under Q280099

BUG #: 236327 (Shiloh_bugs)

SYMPTOMS

The debugging options for the Transact-SQL debugger are dimmed (grayed out) when you debug a stored procedure that contains a RAISERROR statement that raises any error with severity 16 or higher.

The Transact-SQL debugger halts execution of any statement after the RAISERROR statement in the stored procedure executes. The Transact-SQL debugger halts execution of any statement when a RAISERROR statement raises any error message with a severity 16 or higher.

If you select the debug option GO (F5) to execute the stored procedure, the stored procedure exits with @RETURN_VALUE = N/A. However, if the RAISERROR statement raises an error with severity 10 or less, the Transact-SQL debugger functions correctly.

STATUS

Microsoft has confirmed this to be a problem in SQL Server 2000.

MORE INFORMATION

Steps to Reproduce Behavior

To reproduce the problem, follow these steps:

  1. Execute the following stored procedure in Query Analyzer to add a user defined error message:

    EXEC master..sp_addmessage 50003, 16, N'Test raise error 50003 successful,severity 16'
                        
  2. Create a stored procedure:

    CREATE  proc hg_raiseerror AS
    print 'this is message before raiserror statement'
    RAISERROR (50003,16,1)
    print 'this is message after raiserror statement'
    GO
                            
  3. Execute the stored procedure you created in step 2 from the SQL Query Analyzer without using the Transact-SQL debugger. You should see two print statements as follows.

    Here is the message that you see before the RAISERROR statement:

    'this is message before raiserror statement'

    Here is the message that you see after the RAISERROR statement:

    Server: Msg 50003, Level 16, State 1, Procedure hg_raiseerror, Line 5 Test raise error 50003 successful, severity 16
    this is message after raiserror statement

  4. Execute or debug the stored procedure in the Transact-SQL debugger with the GO (F5) option, and only the print statement in line 2 prints before the RAISERROR statement. The following text also displays in the Result pane:

    Server: Msg 50003, Level 16, State 1, Procedure hg_raiseerror, Line 5 [Microsoft][ODBC SQL Server Driver][SQL Server]Test raise error 50003 successful,severity 16 @RETURN_VALUE = N/A

  5. Debug the stored procedure in the Transact-SQL debugger with the Step Over (F10) option and all of the debug options and icons are dimmed (grayed out).



Additional query words: T-SQL debugger TSQL TRAN_SQL grayed out disabled debug option

Keywords: kbbug kbpending KB280099