SQL Server is transferred to the extended stored procedure

xiaoxiao2021-03-06  57

The expansion stored procedure is actually written in C (or any other language) and is not based on SQL DLL. Therefore, any application written in debugging the extended stored procedure and the debug C (or any other language written in the extended stored procedure) is basically the same.

WARNING To avoid potential data loss and other questions, do not debug the extended stored procedure on a computer running as a production server.

Debug extension stored procedure

Use Visual Studio to create a debug version of the extended stored procedure DLL. A application that calls the extended stored procedure to be debugging is needed. If there is no such application, you can:

Create a Visual Studio database project with a data connection between the database that contains the extended stored procedure and the code that calls the extended stored procedure. Create a SQL script file that calls the extension stored procedure. - or - use ISQL / W (provided with SQL Server) or ODBC TEST (provided with ODBC SDK) and other applications. If SQL Server is currently running as a service, open the Service control panel, select "MSSQLServer" and click Stop to stop running. Copy the DLL debug version to the directory where SQLServr.exe resides or copy to any directory in the search path. Tip You can enter the copying DLL command in the Properties Page dialog box, enter the location to: "Configure Properties" Folder -> "Generate Event" Subfolder -> "Generation After Generation Event" Category -> "command Row". For example: Copy c: /myprojects/myxproc/debug/myxproc.dll C: / mssql / binn. Registration Extension stored procedure. For more information, see Register extended stored procedures. Specifies SQL Server as a call executable file and work directory for the extended stored procedure DLL. Modify the settings in the Project Properties dialog box as shown below (Configure Properties "folder ->" debug "category):

If SQL Server is installed in the default location, type C: /Mssql/binn/sqlservr.exe in the "Command" box. Set the Work Catalog item to C: / MSSQL / BINN. Set the command parameter item to -c. -c Option Indicates that SQL Server starts from the command line instead of the service start, which will make SQL Server start faster. SQL Server will not serve as a service as a console application under the Visual Studio debug environment. This makes it possible to capture and process breakpoints correctly. Set breakpoints in the source code of the extended stored procedure. Start debugging sessions using the execution command. For more information, see Performing Control. The console window will appear when SQL Server starts. When the text scroll stops, the last message will be: launched startup procedure 'sp_sqlregister' SQL Server starts and starts processing requests. Perform an extended stored procedure. The debugger is interrupted when it reaches the line of breakpoints.

For further tips for writing extended stored procedures, refer to the SQL Server section of the Microsoft Knowledge Base or the "Programming Extension Store" section of the SQL Server document in the MSDN Library.

转载请注明原文地址:https://www.9cbs.com/read-82240.html

New Post(0)