From: Keith G Hicks on
I'm trying to debug a sql 2005 stored procedure with VS2008. I do this often
and have no trouble but today I need to see teh contents fo a temp table. I
know I can add code to my procedure to dump the temp table's data into a
permanent table but it doesn't seem like I shoul dhaev to do that. If I open
ssms and look at the temp tables I can see the one I'm interested in like
this:

dbo.#tempcusts_______________________________________________________________00000000004

But when I try to do this:

select * from
dbo.#tempcusts_______________________________________________________________00000000004

it doesn't work.

I used to be able to do this in SQL 2000 in enterprise manager. How's this
done in ssms?


From: Erland Sommarskog on
Keith G Hicks (krh(a)comcast.net) writes:
> I'm trying to debug a sql 2005 stored procedure with VS2008. I do this
> often and have no trouble but today I need to see teh contents fo a temp
> table. I know I can add code to my procedure to dump the temp table's
> data into a permanent table but it doesn't seem like I shoul dhaev to do
> that. If I open ssms and look at the temp tables I can see the one I'm
> interested in like this:
>...
> I used to be able to do this in SQL 2000 in enterprise manager. How's this
> done in ssms?

Are you sure that this worked with EM in SQL 2000? As far as I know, it
has never been possible to view the contents of a temp table from a
different session.

Personally, I use PRINT and SELECT in my code to debug. One reason is that
I often want to see the contents of tables.


--
Erland Sommarskog, SQL Server MVP, esquel(a)sommarskog.se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

From: Keith G Hicks on
"Erland Sommarskog" <esquel(a)sommarskog.se> wrote in message
news:Xns9D8CEDC6E2619Yazorman(a)127.0.0.1...
> Keith G Hicks (krh(a)comcast.net) writes:
>> I'm trying to debug a sql 2005 stored procedure with VS2008. I do this
>> often and have no trouble but today I need to see teh contents fo a temp
>> table. I know I can add code to my procedure to dump the temp table's
>> data into a permanent table but it doesn't seem like I shoul dhaev to do
>> that. If I open ssms and look at the temp tables I can see the one I'm
>> interested in like this:
>>...
>> I used to be able to do this in SQL 2000 in enterprise manager. How's
>> this
>> done in ssms?
>
> Are you sure that this worked with EM in SQL 2000? As far as I know, it
> has never been possible to view the contents of a temp table from a
> different session.


Maybe not. I just have a pretty clear recollection of running a stored
procedure from my Delphi code a few years ago and being able to see the
contents of a temp table in QA. I might be remembering somethign else. If I
can remember what I did, I'll try to duplicate it.



> Personally, I use PRINT and SELECT in my code to debug. One reason is that
> I often want to see the contents of tables.
>


Are you talking about when you run a procedure directly in SSMS or when you
run it from source code or from the VS sql debugger window?


> --
> Erland Sommarskog, SQL Server MVP, esquel(a)sommarskog.se
>
> Links for SQL Server Books Online:
> SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
> SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
> SQL 2000:
> http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
>


From: Keith G Hicks on
I think I remember. I have code in that Delphi app that creates a ## global
temp table in the backend. It's not created in a stored procedure, it's
created by running a command from the front end.

"Keith G Hicks" <krh(a)comcast.net> wrote in message
news:ez%235R%239ALHA.5848(a)TK2MSFTNGP06.phx.gbl...
> "Erland Sommarskog" <esquel(a)sommarskog.se> wrote in message
> news:Xns9D8CEDC6E2619Yazorman(a)127.0.0.1...
>> Keith G Hicks (krh(a)comcast.net) writes:
>>> I'm trying to debug a sql 2005 stored procedure with VS2008. I do this
>>> often and have no trouble but today I need to see teh contents fo a temp
>>> table. I know I can add code to my procedure to dump the temp table's
>>> data into a permanent table but it doesn't seem like I shoul dhaev to do
>>> that. If I open ssms and look at the temp tables I can see the one I'm
>>> interested in like this:
>>>...
>>> I used to be able to do this in SQL 2000 in enterprise manager. How's
>>> this
>>> done in ssms?
>>
>> Are you sure that this worked with EM in SQL 2000? As far as I know, it
>> has never been possible to view the contents of a temp table from a
>> different session.
>
>
> Maybe not. I just have a pretty clear recollection of running a stored
> procedure from my Delphi code a few years ago and being able to see the
> contents of a temp table in QA. I might be remembering somethign else. If
> I can remember what I did, I'll try to duplicate it.
>
>
>
>> Personally, I use PRINT and SELECT in my code to debug. One reason is
>> that
>> I often want to see the contents of tables.
>>
>
>
> Are you talking about when you run a procedure directly in SSMS or when
> you run it from source code or from the VS sql debugger window?
>
>
>> --
>> Erland Sommarskog, SQL Server MVP, esquel(a)sommarskog.se
>>
>> Links for SQL Server Books Online:
>> SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
>> SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
>> SQL 2000:
>> http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
>>
>
>


From: Erland Sommarskog on
Keith G Hicks (krh(a)comcast.net) writes:
> "Erland Sommarskog" <esquel(a)sommarskog.se> wrote in message
>> Personally, I use PRINT and SELECT in my code to debug. One reason is
>> that I often want to see the contents of tables.
>>
>
> Are you talking about when you run a procedure directly in SSMS or when
> you run it from source code or from the VS sql debugger window?

Directly from SSMS. (Or Query Analyzer, which I prefer to use at work.)
I don't use Visual Studio to work with SQL Server. (Visual Studio leaves
me in a complete maze.)


--
Erland Sommarskog, SQL Server MVP, esquel(a)sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx