Solved

transac sql breakpoint

Posted on 2006-07-21
8
412 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
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
 
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

Introduced in Microsoft SQL Server 2005, the Copy Database Wizard (http://msdn.microsoft.com/en-us/library/ms188664.aspx) is useful in copying databases and associated objects between SQL instances; therefore, it is a good migration and upgrade tool…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now