debugging SQL Server stored procedures and user-defined functions

Source: Internet
Author: User
Tags execution functions mssqlserver query requires
server| Stored Procedures | functions

1. Debugging in Query Analyzer
The steps for debugging in Query Analyzer are as follows:
SQL 2000 Query Analyzer
--left Join's Object Browser (no words pressed F8)
--In Object items
--Right-click Stored procedures for debugging
--Debugging
--Input parameters (all parameters must be entered, including default/output parameters)
--Click to execute
--a floating tool bar appears
--The above has single-step, breakpoint setting and so on

Pressing F11 is single-step.

If you want to run to the specified line, simply move the cursor to the specified line, and then press CTRL+F10

2, through the output stored procedures or user-defined functions of the processing results of debugging
If you cannot debug a stored procedure using Query Analyzer, you can add print or SELECT statements directly in the stored procedure to output the execution results of the steps in the stored procedure. For user-defined functions, you cannot use print or SELECT statements to output the results of each step, to schedule a user-defined function, you can change the user-defined function to a stored procedure, debug successfully, and then change back to the user-defined function.

3, in the VB.net debugging

menu, select "Tools"--"Connect to Database"
Select View--Server Explorer
In Server Explorer, right-click the stored procedure or user-defined function that you want to debug-stepping.

4, to ensure that the Query Analyzer or vb.net can successfully debug a few things

1.   remote SQL Server MSSQLSERVER service requires the use of the specified user (not the local system user), preferably the administrator startup.
     Control Panel--Administrative Tools--services--right--mssqlserver--properties--Login, change the login status to "This account" and set the corresponding username and password.
2.   users who log on to remote SQL use SA
3.   the remote SQL Server requires that debugging not be disabled, execute the following statement to turn on debugging:
     Sp_sdidebug legacy_on
4.   guarantees that debugging is consistent with the SQL Server version of the computer being debugged, whether it is a client or a server, and it is best to install SQL SP4.
     Check that sq serverl is not patched by running in Query Analyzer:
     SELECT @ @version
     if the version number below is 8.00.2039, the SP4 patch is not installed.
     location of all patches (in the middle of the download page, you can choose a language, you must ensure that the download patch language corresponds to the SQL Server instance language)
     Simplified Chinese layout SQL Server 2000 should be installed with the patch
Note:
     a.  patch Download, when the execution is decompression, To perform setup.bat in the unpacked directory is the true installation of
     b.  if the operating system is XP, after installing XP SP2, install it again, regardless of whether you have previously installed SQL SP4, and open 1433 ports in the firewall, otherwise can not be accessed by other computers.
     c.  SQL Server running on Windows 2003 must have a SP3 or higher patch version installed.



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.