all groups > sql server mseq > october 2003 >
You're in the

sql server mseq

group:

Temp table names


Temp table names Dinesh Balakrishnan
10/30/2003 3:22:48 AM
sql server mseq:
Hi,
I am trying to work out the actual table names for
temp "#" table names created in a session.

For e.g if i have a seesion which has created a temp table
#temp1 what will be the actual table name in sysobjects?

I can see an entry in tempdb..sysobjects saying
"#temp1____________________________________________________
_________________________________________________________00
0000022F33"
and the spid of my seesion is 131.

What i need to kno is how to work out the name?
I need this to work out details of all temp tables created
by a particula session and the data size etc...
This is to monitor tempdb space.

Re: Temp table names dinesh
10/30/2003 4:01:47 AM

[quoted text, click to view]
Thamks. But i am not looking out for the data in the
tables. I am more interested in statistics connected to
the table like data size, index size etc. For this i will
Re: Temp table names Anith Sen
10/30/2003 9:42:32 AM
To get the name, you can do:

SELECT name
FROM tempdb..sysobjects
WHERE id = OBJECT_ID('tempdb..#temp') ;

For general purposes, you can directly use most of the system stored
procedures on the #temp table directly like:

EXEC tempdb..sp_help #temp

--
- Anith
( Please reply to newsgroups only )

Re: Temp table names Shaju
10/30/2003 5:14:25 PM
Hey u can directly say select * from #temp1 ignore the rest of the name

--
Shaju Thomas
e-Cosmos Technologies Ltd.,
Mail: shaju@e-cosmostech.com
Phone(Off) : 51217038/39 Extn: 132
Mobile: +91 98455 21794
[quoted text, click to view]

Re: Temp table names Nigel Rivett
10/31/2003 3:48:26 AM
I guess you want to access this from another spid.
I don't know how the value at the end is allocated but I
believe it is constant for a spid. The first couple of
bytes is a nest level and the rest an identifier for the
spid.

create a temp table in an sp then call another sp which
AddThis Social Bookmark Button