Hunderfert
Hunderfert

Reputation: 41

view created table in microsoft sql server

I am running part of a query in Microsoft SQL server management studio

Select  Table1.Column1

into #Table2 

from Table1 

now it has created the table but I actually want to view this table with my eyes but I cannot seem to find where the table is stored. Please could someone help me find it?

Upvotes: 0

Views: 467

Answers (2)

Thom A
Thom A

Reputation: 96028

Any tables where its name start with # is a Temporary Table. Exactly as the name suggests, it's temporary, and only exists for the same time the connection that created it does (or it is dropped).

If you want to view the data from a temporary table, you would do so like any other table SELECT * FROM #Table2;. .

I imagine what your really after is to not use a temporary table, so drop the # from the name, and the new table will be created in the database you are connected to.

Upvotes: 2

Rigerta
Rigerta

Reputation: 4039

That is a temporary table. It will be created in the tempdb system database and you can see it by going to tempdb -> Temporary Tables.

enter image description here

Upvotes: 2

Related Questions