Click here to Skip to main content
15,895,812 members
Articles / Database Development / SQL Server
Article

SQL Stored Procedure Debugging from SQL Query Analyzer

Rate me:
Please Sign up or sign in to vote.
2.70/5 (8 votes)
21 Aug 2007CPOL1 min read 45.7K   22   2
Debugging a SQL Stored Procedure in SQL Server 2000 Query Analyzer

Introduction

Debug is the way to show your applications data flow or Execution flow

MS SQL Server 2000 provides to debug the stored procedures, Step by step debugging shows the flows of execution ponters.

Permissions and Security

system procedure sp_sdidebug provide to enable your debugging in yout T-SQL AQuery analyzer,
Before of debugging you need to ececute this system pocedure
sp_sdidebug 'LEGACY_ON' Same thing you can also off the debugging using this
sp_sdidebug 'LEGACY_OFF'Be careful that any other SQL permissions or authentication is still in effect or attempt to debug using a different user account than the actual bug demonstrates.

Debugging

Once you have the object browser tree view visible, select a stored procedure in a database and right-click on the stored procedure name. The right-click menu should have a 'debug' option at the very bottom.

If this Debug in menu option is not enabled then, you should review the permissions associated with your current user

Debug Procedure

Right click on the stored procedure name in the object browser tree view and choose 'debug'. This will bring up a 'Debug Procedure' window for you to enter initial values for any parameters

Same thing pass the value of second parameters then execute.

Summary

SQL Server 2000 Debugging is a huge step forward. You can have complex, nested code in stored procedures and be able to test them confidence regarding the statement of the database at each statement. This allows you to keep the transactional power and processing speed on the SQL server instead of trying to reinvent those features in the calling application.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Tester / Quality Assurance Fiserv
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralMy vote of 2 Pin
JBress3-Jul-09 5:49
JBress3-Jul-09 5:49 
GeneralCannot reproduce as you instruct Pin
Ricky Wang31-May-09 16:49
Ricky Wang31-May-09 16:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.