Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Debugging or a parody on it?

Status
Not open for further replies.

evilDBA

Programmer
Oct 2, 2007
12
RU
Hi, I am new here.

I tried to debug stored procedures in the Visual Studio and you know… it was a real shock. Like going in time 10 or 20 years back.

The stored procedures I deal with contain a lot of @tab and #tab, but it appears that I can not evaluate the values of these objects! The only type of object I can evaluate is a variable. But SQL is designed for the table data, right? So the most important type of data is not accessible!

How can I understand, what records have been affected by Update or inserted by Insert? Using prints or debug selects? Is it an era of FORTRAN or ALGOL???

To make it worse, to enter a debugger, I need to provide values of all parameters. It might be simple for the outermost procedure, but for inner stored procs, and where some parameters are some short-living identity values of some records, created in a transaction, it is very difficult to prepare all conditions to make a correct run.

So my question is, may be I had overlooked something? Is it a real debugger or just a joke from Microsoft? Sorry, but I am really angry after wasting a lot of time last week on it.
 
I never use the sql debugger...

--------------------
Procrastinate Now!
 
In SQL Server 2005, you can make use of the OUTPUT clause. It is similar to triggers in that it is based on the usage of Inserted and Deleted tables:

Code:
--returns modified records in their original state:
          UPDATE dbo.MyTable
             SET myColumn = '111'
OUTPUT DELETED.*
           WHERE myColumn = '1'



< M!ke >
[small]"Oops" is never a good thing.[/small]
 
I agree with Crowley16. I never use the SQL debugger.

Denny
MCSA (2003) / MCDBA (SQL 2000)
MCTS (SQL 2005 / Microsoft Windows SharePoint Services 3.0: Configuration / Microsoft Office SharePoint Server 2007: Configuration)
MCITP Database Administrator (SQL 2005) / Database Developer (SQL 2005)

--Anything is possible. All it takes is a little research. (Me)
[noevil]
 
I do use the debugger although not from the application. One nice thing about it is it steps through the triggers. There could be trigger activity you aren't aware of. Especially if you are new to the environment and don't know it like the programmers that developed it.

As far a debugging from the application I usually take what it is passing to SQL and cut and paste it into query analyzer to debug it.
 
>I also use SQL Profiler quite a lot to see exactly what is being executed.

It is much more difficult for nested procedures.

BTW the utility I found really works.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top