Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Temporary Table Structure

Author  Topic 

yenny.lauw
Starting Member

14 Posts

Posted - 2006-10-04 : 01:00:04
Hi guys, what is the query to use in order to see temporary table (eg: #tablename) structure ?

thx

Cowboy | Alopecia Areata | Fold T-Shirt Fast | Naked in 7 seconds

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-10-04 : 01:04:12
USE TempDB

sp_help #MyTempTable



Peter Larsson
Helsingborg, Sweden
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-10-04 : 01:05:38

tempdb..sp_help #tablename


KH

Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-10-04 : 01:06:47


Peso, you are fast


KH

Go to Top of Page

yenny.lauw
Starting Member

14 Posts

Posted - 2006-10-04 : 01:10:04
query analyzer said that this table does not exists ? while I just ran the script that create the table

Cowboy | Alopecia Areata | Fold T-Shirt Fast | Naked in 7 seconds
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-10-04 : 01:35:50
How do you create the table and how do you run the script ?


create table #temptable
(
col int,
col2 datetime
)

exec tempdb..sp_help #temptable

drop table #temptable



KH

Go to Top of Page

yenny.lauw
Starting Member

14 Posts

Posted - 2006-10-04 : 02:20:04
hi khtan,

thx for replying, I just realized that I open new session to run the sp_help #tablename, this is why query anaylzer keep saying table not found, but if I run the command on the same session, it works.

thx a lot to you all

Cowboy | Alopecia Areata | Fold T-Shirt Fast | Naked in 7 seconds
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-10-04 : 02:32:29
quote:
Originally posted by yenny.lauw

hi khtan,

thx for replying, I just realized that I open new session to run the sp_help #tablename, this is why query anaylzer keep saying table not found, but if I run the command on the same session, it works.

thx a lot to you all

Cowboy | Alopecia Areata | Fold T-Shirt Fast | Naked in 7 seconds


temp table is per connection. So a new sesion in QA is a different connection.


KH

Go to Top of Page
   

- Advertisement -