开发者

SQL 2008 : How can i see Temptable in DB?

I have made one temp table in my dat开发者_开发问答abase. 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

SQL 2008 : How can i see Temptable in DB?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜