How to Debug your Stored Procedure?
2010-02-25 16:21
465 查看
How to Debug your Stored Procedure?
In many cases, you might want to test your SP on various scenarios and go through each step on how your data gets changed at each step. The below steps should help you to achieve the goal:
a) Go to SQL Enterprise Manager -> Query Analyzer
b) Click on Object Browser link (1) on the Top Menu to display all the databases in your Server
c) Browse through to your Stored Procedure from the Left menu.
d) Select your SP and right click.
e) Select the Option “Debug”.
f) The “Debug Procedure” dialog box shows up with options to enter your test data in “Value” for the selected input parameter displayed in “Parameters”. If you have multiple input parameters, select each parameter and enter valid values. You could select the checkbox “Set to NULL”, if the input parameter can accept NULL values. The debug procedure also displays the “Parameter Type” and the direction (input or output) of the variable.
g) Once the input parameters are entered, click on “Execute”.
h) The SP will be displayed on the SQL pane and the “Debug” arrow shows up on the first line.
i) You will be able to see your input parameters passed on to the variables and also any other variables that you are using in your Stored Procedure.
j) You can debug to the next step by pressing “F10”
k) You can use “F5” to execute all the steps in SP without toggling at each step.
l) You can use “F11” to “step into” each step i.e., if you go one step further inside the current step to debug especially if you have used any other SP in your SP.
m) There are many other options for debugging and you can find them at the top of your SQL pane.
In many cases, you might want to test your SP on various scenarios and go through each step on how your data gets changed at each step. The below steps should help you to achieve the goal:
a) Go to SQL Enterprise Manager -> Query Analyzer
b) Click on Object Browser link (1) on the Top Menu to display all the databases in your Server
c) Browse through to your Stored Procedure from the Left menu.
d) Select your SP and right click.
e) Select the Option “Debug”.
f) The “Debug Procedure” dialog box shows up with options to enter your test data in “Value” for the selected input parameter displayed in “Parameters”. If you have multiple input parameters, select each parameter and enter valid values. You could select the checkbox “Set to NULL”, if the input parameter can accept NULL values. The debug procedure also displays the “Parameter Type” and the direction (input or output) of the variable.
g) Once the input parameters are entered, click on “Execute”.
h) The SP will be displayed on the SQL pane and the “Debug” arrow shows up on the first line.
i) You will be able to see your input parameters passed on to the variables and also any other variables that you are using in your Stored Procedure.
j) You can debug to the next step by pressing “F10”
k) You can use “F5” to execute all the steps in SP without toggling at each step.
l) You can use “F11” to “step into” each step i.e., if you go one step further inside the current step to debug especially if you have used any other SP in your SP.
m) There are many other options for debugging and you can find them at the top of your SQL pane.
相关文章推荐
- How to debug stored procedure/function in TOAD
- How to DEBUG a trigger or procedure
- How to debug your program when NUnit is running?
- [转]How to get return values and output values from a stored procedure with EF Core?
- navicate how to create a stored procedure
- How to call an Oracle Stored Procedure that returns one or more REF CURSORS, using ADO from C++ How
- EF 接收OUTPUT参数的方法 How to Retrieve Stored Procedure Output Parameters in Entity Framework
- How do I pass a CLOB value to a stored procedure
- How to invoke a Web Service from a Stored Procedure
- How to debug your application (http protocol) using Fiddler
- How to debug your application (http protocol) using Fiddler
- Pass CSV string as parameter to your SQL Server stored procedure
- How to execute a Stored Procedure with Entity Framework Code First
- navicate how to create a stored procedure
- [原] XAF How to bind a stored procedure to a ListView in XAF
- illustrates how to call a SQL Server stored procedure
- How to call stored procedure in Hibernate
- How to use Oracle 11g ODP.NET UDT in an Oracle Stored Procedure's Where clause
- Why we made vorlon.js and how to use it to debug your JavaScript remotely
- How to call Oracle function or stored procedure using spring persistence framework?