[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

transac sql breakpoint

Posted on 2006-07-21
8
Medium Priority
?
444 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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 2000 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

650 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