• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 447
  • Last Modified:

transac sql breakpoint

hello,


I am new to transact sql

how do i put debug statements in transact sql and where it will be printed

how do i put breakpoint on a  transac sql  statement ; should i do this in query analyzer ?


thankyou!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
0
royalcyber
Asked:
royalcyber
1 Solution
 
DireOrbAntCommented:
Stick PRINT or SELECT here and there in your code to debug it

PRINT 'Before Insert'
INSERT.......
PRINT 'After Insert'
DELETE....
PRINT 'After Delete'

Run that code in QA.
0
 
DireOrbAntCommented:
I've never used it and unsure if it still applies to 2005, but there is a T-SQL debugger:
http://www.dbazine.com/sql/sql-articles/larsen9
0
 
Einstine98Commented:
There isn't anything like the normal break-points you have in VS.NET... however, DireOrbAnt way is one good way of debugging your code.. it's equivalent to adding a msgbox in your code and poping it up after each step...

the outcome will show in query analyzer and if you run it as a job in the job history, but if run through a stored procedure in an application you won't get anything....

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
DireOrbAntCommented:
In a stored roc, you can do:
PRINT 'Before Insert'
INSERT.......
PRINT 'After Insert'
DELETE....
PRINT 'After Delete'

However I don't recall if you get the printout sequential. Maybe if you use to show result as text in QA?
0
 
royalcyberAuthor Commented:
where do i get the "T-SQL debugger" from for sql server 2000
0
 
DireOrbAntCommented:
From Object Browser in QA (Tools->Object Browser or F8)
The find your proc on left side, right-click, debug.
0
 
pootle_flumpCommented:
FYI - it is not as user friendly as VS debugging tools. I rarely bother with it unless I am really struggling - better to stick with PRINT. Also MS recommend you don't run the debugger on a prod server as it really takes up server resources.
0
 
Aneesh RetnakaranDatabase AdministratorCommented:
royalcyber,
> how do i put breakpoint on a  transac sql  statement ; should i do this  in query analyzer ?
There is a debugger fascility available in sql server 2000, but the thing is you can debug only stored procedures. Also you need to configure the sql service account as the user with which you are  logon to the Windows (Start->run -> Services.msc

then find the sql server servise 'MSSQLserver', rightclick-> properties , move to logon tab, there you can find the option local system account and some other account, you need to browse and  select the user with which you are logging . Once this is done, restart the service . )
Now you can go to the Query analyyzer, Press F8 to get the object browser, right click on the desired sp -> put input parameters if any,  that's it
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now