Groups | Blog | Home
all groups > sql server programming > september 2004 >

sql server programming : SP and Trigger debugging


Just D.
9/16/2004 11:56:03 PM
All,

How are you doing debugging of this stuff? If I wrote a SP or Trigger in a
few thousand lines including variables, loops. switches, error code
evaluation, etc., it's hard or even impossible to use the Query Analyzer to
look inside the working process like from a usual programming environment.
Maybe I don't know anything, but I really would like to get some IDE where I
can go through the script step by step, look into variables, fields, etc.,
stop execution any time, interrupt, restart, etc. If something like that
exists in the world? Is it possible to get it for reasonable money or for
free as a component of a MSSQL Server, VS 2003, or whatever?

Thanks,
Just D.

Ramnadh
9/17/2004 1:35:02 AM
It is more feasible if you debug the stored procedures and Triggers from the
SQL Server. If any way you need IDE to debug the stored Procedure VS.Net
provides the facility to debug the Procedure and Triggers with an excellent
IDE. You can try with it.

[quoted text, click to view]
Hugo Kornelis
9/17/2004 9:34:11 AM
[quoted text, click to view]

Hi Just,

Query Analyzer has a debugger. You have to start at a stored procedure, so
if you have to debug a trigger, make a procedure that holds the insert,
delete or update statement that fires the trigger and debug that
procedure.

In QA, hit F8 to bring up the object browser, find the stored procedure
you want to debug, right-click and select "Debug...". You can supply the
parameters the proc will be called with. Then the debugger will run,
allowing you to step through the code, set breakpoints, step into or over
called procedures, examine the value of variables, etc.

It does have it's shortcomings, though. The debugger doesn't allow you to
change the value of a variable or to execute an ad-hoc query to examine
the contents of changed rows (and you can't use ad-hoc queries in another
window either, as the rows are locked).

Best, Hugo
--

AddThis Social Bookmark Button