Friday, July 6, 2007

Debugging Stored Procedures (SQL Adapter)

Programming errors in stored procedures can often be more easily identified by stepping through the code one statement at a time. This gives you the opportunity to not only verify stored procedure arguments and variables, but also check data in tables, error values, and other variables that are affected by the stored procedure.

To debug a SQL Server stored procedure using Visual Studio

1. Open a BizTalk project using Visual Studio 2005.

2. On the Visual Studio View menu, click Server Explorer.

3. In the Server Explorer pane, right-click Data Connections and then click Add Connection.

4. On the Choose Data Source screen, click Microsoft SQL Server and then click Continue.

5. On the Add Connection screen, choose a server name from the drop-down list or type a server name, and choose a logon method. If you choose Use SQL Server Authentication, supply a User name and Password. Choose a database to connect to, and then click OK.

6. In the Server Explorer pane, expand the database and then expand Stored Procedures to expose the stored procedures.

7. Right-click one of the stored procedures and then click Step Into Stored Procedure.

8. On the Run Stored Procedure screen, enter values for each of your stored procedure arguments.

9. Step through the stored procedure using F10, breakpoints, and the other tools available in Visual Studio 2005.


Source: Microsoft

No comments: