Debugging SQL Server 2012 stored Procedures

Source: Internet
Author: User

"One" SQL Server about stored procedure debugging
SQL2000 is the stored procedure you want to debug in the Object Browser in Query Analyzer, right-----debugging---Input parameters to start debugging.
The sqlserver2008 is completely different and becomes a must to exec [PROCEDURE NAME] @VAR1 in SSMs, @VAR2, then click on the green triangle or debug---in the Point menu to start debugging. Then click on the rightmost step of the toolbar to debug or jump out. The following variable window and Stack window can be used to view dynamic values such as variables in debugging.
sqlserver2008 debugging requirements and Conditions: If you are debugging on the computer or server where the engine resides, only the SA or Windows user is required to log in. If you are debugging offsite, you will need to set up firewall exceptions, add SSMs and SQLSERVER.EXE to allow, add 135 ports allowed to pass.
Configuring the Transact-SQL debugger

Http://technet.microsoft.com/zh-cn/library/cc646024.aspx

Debug of the "two" VS 2010 stored procedure.

For debugging stored procedures, now summarize the following 2 ways to find a single-step debug stored procedure:

1. This method has been done by itself and is possible, as follows:

A. If a stored procedure exists in the target database, right-click the stored procedure-Modify, open the stored procedure, and set the breakpoint where needed. (If you do not have a custom stored procedure, you need to create a stored procedure in the SQL Server 2012 database and set a breakpoint on it when you are done);

B. Also open a new query window, write the calling code: for example, exec billmanageinputproc ' master single 1 ', ' 0111111 ', ' 0111112 ', ' 121 ', ' legend ', ' 2014-09-24 ', ' 001 ', ' 2014-09-24 ', ' 1 ', ' marketing department ', ' 0 ', click the Debug button to start debugging the stored procedure;

C. Click F 11 For step-by-step debugging.

2. In the vs2010 debug stored procedure steps are as follows:

First, open vs, click View--Server Explorer

Select data connection, right click, click Add Connection

Select the server and database where the stored procedure resides

Select the stored procedure that you want to debug, right-click, select Single-Step debugging

VS will require the input parameter value

Then go to single-step debugging, go to the single-paced test just like debugging C # or vb.net code, you can monitor the value of the variable, and if the execution of the process involves a trigger, will also jump into the trigger, execute the trigger code

Monitoring variables:

At this point, you can debug the stored procedure just as you would debug an application.

Debugging SQL Server 2012 stored Procedures

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.