Debugging Stored procs in vs.net ide

  • Thread starter Thread starter Frank Rizzo
  • Start date Start date
F

Frank Rizzo

I am debugging a stored proc inside the IDE which is great. However,
the stored proc dumps some data into temp tables. Is there a way to see
the contents of the temp tables while in debug mode?

Thanks
P.S. I posted it earlier in c# ng but no help, thus repost here.
 
Frank said:
I am debugging a stored proc inside the IDE which is great. However,
the stored proc dumps some data into temp tables. Is there a way to see
the contents of the temp tables while in debug mode?

Try to use ##temp tables instead of #temp tables so they're visible for
other connections as well. You can then debug the procs in query
analyzer which is much more efficient than in vs.net.
Thanks
P.S. I posted it earlier in c# ng but no help, thus repost here.

Heh, a question about debugging a stored procedure, not really a C#
topic, don't you think? ;)

FB

--
 
Frans said:
Try to use ##temp tables instead of #temp tables so they're visible
for other connections as well. You can then debug the procs in query
analyzer which is much more efficient than in vs.net.

Say what? You can debug in Query Analyzer? That's something new to me.
By debug I mean, step through the code.

Also, can you or can you not see the contents of the temp tables in
vs.net debugger?
Heh, a question about debugging a stored procedure, not really a C#
topic, don't you think? ;)

I live in c# world, so didn't think before posting :)
 
A #temp table is owned by the SP that creates it so it will be dropped
automatically once the SP ends. However, there are ways to "see" the data in
a #temp table--they're stored in TempDB with a UserID/owner prefix. If you
get into Query Analyzer and enter this SQL (for your own test table) you can
see this in action.

SELECT TOP 10 Author, Year_Born INTO #TEMP FROM authors

Copies 10 rows into #temp and creates a table named
"dbo.#temp______________________000001B" (or somesuch). The problem is that
it does not seem that any of the tools included in the Visual Studio or SQL
Server suites (and I tried four of them) could open this table. I might try
to write a test application to do so though. You should be able to see the
data (I've done in the past) one way or another. No, the Visual Studio IDE
in 2003 and 2005 won't let you see it.

hth

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
Ah, sucks. DB Artisan's debugger automatically keeps live temp tables
gened by the stored in separate tabs - so convinient. But the damn
thing is so expensive.
 
Frank said:
Say what? You can debug in Query Analyzer? That's something new to me.
By debug I mean, step through the code.

Yes, you can, you can even set breakpoints :)

Just right-click the procedure in the object browser and select
'debug'. You then fill in initial parameters and start at the beginning
of the proc. You can then set a breakpoint, step through the code etc.

When you use ##temp tables, IMHO you can see them from another
connection. This means that you can step through the proc, and when the
temptable is created ,you open another query analyzer and check the table.
Also, can you or can you not see the contents of the temp tables in
vs.net debugger?

#temp tables are connection specific, if I'm not mistaken ##temp tables
are accessable by all connections.

FB

--
 
Back
Top