Home All Groups Group Topic Archive Search About

Debugging Stored Procedures with Query Analyzer

Author
23 Aug 2006 2:21 PM
Stephan Zaubzer
I have the following problem:
When trying to debug a stored procedure with query analyzer it does not
stop at the first line of code. Instead it runs throug the whole
procedure and I cannot stop it! Am I missing something?
Without being able to interrupt the procedure I want to debug, the
debugger is useless...
Regards
Stephan

Author
23 Aug 2006 9:46 PM
Arnie Rowland
Did you set breakpoints?
Is there more happening than just one query?

--
Arnie Rowland, Ph.D.
Westwood Consulting, Inc

Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous


Show quote
"Stephan Zaubzer" <stephan.zaub***@schendl.at> wrote in message
news:%23VQq%239rxGHA.3460@TK2MSFTNGP03.phx.gbl...
>I have the following problem:
> When trying to debug a stored procedure with query analyzer it does not
> stop at the first line of code. Instead it runs throug the whole procedure
> and I cannot stop it! Am I missing something?
> Without being able to interrupt the procedure I want to debug, the
> debugger is useless...
> Regards
> Stephan
Author
23 Aug 2006 10:10 PM
Erland Sommarskog
Stephan Zaubzer (stephan.zaub***@schendl.at) writes:
> I have the following problem:
> When trying to debug a stored procedure with query analyzer it does not
> stop at the first line of code. Instead it runs throug the whole
> procedure and I cannot stop it! Am I missing something?
> Without being able to interrupt the procedure I want to debug, the
> debugger is useless...

Getting the debugger to work requires so much red tape that I have
essentially given up on it. The only exception is possibly if QA and
SQL Server is on the same machine.

First check in Help->About in Query Analyzer which version of QA you have.
Then compare that with @@version. If QA has less than 8.00.760 and
@@version is 8.00.760, you need to upgrade your client tools to SP3.

If you are running Windows XP SP2, with or without firewall enabled,
you need SP4 on both server and client, and configure your firewall
to permit the server to connect to you. (But I don't think you have
this problem, as you usually get an error message as I recall.)

Also, the service account under which SQL Server runs needs some
rights on your machine.

There is a section "Troubleshooting the Transact-SQL Debugger" on
Books Online that may give further tips.



--
Erland Sommarskog, SQL Server MVP, esq***@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
Author
24 Aug 2006 1:03 AM
Ed Murphy
On Wed, 23 Aug 2006 16:21:56 +0200, Stephan Zaubzer
<stephan.zaub***@schendl.at> wrote:

>When trying to debug a stored procedure with query analyzer it does not
>stop at the first line of code. Instead it runs throug the whole
>procedure and I cannot stop it! Am I missing something?
>Without being able to interrupt the procedure I want to debug, the
>debugger is useless...

There's always the old-school approach of adding temporary PRINTs
into the procedure, provided that you remember to take them out
afterward (or key them to some central flag, e.g. "if table X
contains record Y").

AddThis Social Bookmark Button