Solved

transac sql breakpoint

Posted on 2006-07-21
8
437 Views
Last Modified: 2012-08-13
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
Comment
Question by:royalcyber
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 26

Expert Comment

by:DireOrbAnt
ID: 17158042
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
 
LVL 26

Expert Comment

by:DireOrbAnt
ID: 17158058
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
 
LVL 12

Expert Comment

by:Einstine98
ID: 17158068
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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
LVL 26

Expert Comment

by:DireOrbAnt
ID: 17158080
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
 

Author Comment

by:royalcyber
ID: 17158089
where do i get the "T-SQL debugger" from for sql server 2000
0
 
LVL 26

Accepted Solution

by:
DireOrbAnt earned 500 total points
ID: 17158206
From Object Browser in QA (Tools->Object Browser or F8)
The find your proc on left side, right-click, debug.
0
 
LVL 11

Expert Comment

by:pootle_flump
ID: 17158390
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
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 17158692
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
I have a large data set and a SSIS package. How can I load this file in multi threading?
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question