简体   繁体   中英

SQL 2008 : How can i see Temptable in DB?

I have made one temp table in my database. My question is "How can i see my temp table in database ?" Is it physically allocated ?

When you create a table prefaced with a pound sign, it gets created in your tempdb database. Once the procedure calling it is over, it is automatically dropped.

create table #notforlong (id int,catname varchar(20))

It now exists in tempdb

You could find it in sysobjects where name like '#notforlong%'. However, since it goes away outside your proc anyway, I'm not sure it's helpful to refer to it this way.

Your question is completely unclear.

What do you mean by "seeing the table graphically"?

Here's an answer for one interpretation of it as you also mention physical allocation (Assumes: SQL Server 2008)

CREATE TABLE #foo
(
bar int,
baz nchar(100)
)

insert into #foo values (1, REPLICATE('A',100))

select sys.fn_PhysLocFormatter(%%physloc%%) AS RID, bar, baz
FROM #foo /*Returned 1:121:0 for me*/

Then look at that page in SQL Internals Viewer

屏幕截图

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM