INF: Tips for Debugging Stored Procedures from VC++

Last reviewed: April 10, 1997
Article ID: Q156096

The information in this article applies to:
  • Microsoft SQL Server, version 6.5

SUMMARY

With Visual C/C++ 4.2 Enterprise Edition you can debug SQL Server stored procedures and triggers. This article contains a list of 16 assorted tips that may help you in debugging. At the end of the article, there is an excerpt from the Readme.txt file.

MORE INFORMATION

  1. Text, numeric, and float data types cannot be edited in a watch window.

  2. You must have the Enterprise Edition of Visual C/C++ 4.2, not Professional or Standard, to debug.

  3. You must apply Service Pack 4 for Windows NT 3.51 computers.

  4. You must have applied Service Pack 1 for SQL Server 6.5, which shipped with the Visual C/C++ Enterprise edition.

  5. SQL Server must run under a user account. When run under the local account, the breakpoints are ignored and the query is simply executed.

  6. Extended error information may be contained in the Windows NT
Eventlog.
    Specifically, Event ID 11 relates directly to item 5 above.

       Event ID #11: SQL Server when started as service must not log on as
       System Account. Reset to logon as user account using Control Panel.

    The event entries are made under MSDEVSDI.

  • Best performance when debugging is achieved if the SQL Server is

        running under the same user account with which you are logged on to
    
    the
        Windows NT computer. A quick way to assure this is to start SQL Server
        in a Windows NT command prompt, as follows:
    
           ..\MSSQL\BINN\SQLSERVR -c
    
    

  • It is not recommended you debug on a production server. Due to the added overhead and break-in nature of the debugging product you could adversely effect other users.

  • Debugging is only supported on SQL Server version 6.50 or later.

  • String and text values longer than 255 bytes are shown as NULL in the watch window.

  • Use the right mouse, refresh option to obtain object changes in DDL from other clients.

  • Dump table does not perform the Transact-SQL dump command but performs a select * from the selected table. Be careful; many results can be written to the output window. For large tables you should use a standard SQL Server query window.

  • If you delete all characters from a string in the watch window, the value will show NULL. If the variable does not allow NULL the next step operation will reset the value to its previous value.

  • Only the first 64 bytes of a text column are displayed in the output window, even if more data is contained in the actual column.

  • You can add global variables like @@ERROR to the watch window.

  • You must use the DBLIBRARY version 6.50.212 or the SQL Server ODBC 2.50.0212 or later version to be able to step from source code to stored procedure code and back.

  • If installing for VC 4.2 you must apply SQL Server Service Pack #1 to get the proper SDI debugging components. If installing for VC 5.0 you should install the "VC++ Enterprise Edition Server Components" from install CD #2.

    For more details be sure to read the Readme.txt file shipped with Visual C/C++ The following is an important excerpt from the Readme file.

    • SQL Server Debugging must be enabled. To enable SQL Server debugging, check the SQL Server Debugging check box on the SQL tab of the Options dialog box. The Options dialog box is available by choosing the Options command on the Tools menu. If using VC++ 5.0 the tab is Data View instead of SQL.
    • The Remote Connection must be set to Local, not to TCP/IP or to Serial. To set the Remote Connection, choose the Remote Connection command on the Tools menu.
    • The current project must be of type x86 (not Macintosh). To set the current project type, choose the Configurations command from the Build menu.
    • The stored procedure must be stored on SQL Server version 6.5 or later.
    display


  • Additional query words: VCEntIss
    Keywords : kbinterop kbnetwork SSrvStProc
    Version : 6.5
    Platform : WINDOWS


    THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

    Last reviewed: April 10, 1997
    © 1998 Microsoft Corporation. All rights reserved. Terms of Use.