Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to see temp table created by code in sql server?

Tags:

I create a global temp table (i.e ##TheTable) using C# code. I want to be able to see that temp table in SQL server management studio after the code runs completely.

Is it possible to do this ? If yes, then how ?

like image 327
InTheSkies Avatar asked Jan 29 '14 19:01

InTheSkies


People also ask

How can I check for the existence of a temporary table?

SELECT '#TempTable Exists'; This method takes into account the scoped temporary table, and gets its object_id from tempdb. If it exists, you will get a non-null value. A null value means that it doesn't exist.

Where is temp table data stored SQL Server?

Temporary tables are stored in tempdb Database.

How do I find the temp table columns in SQL Server?

To retrieve the list of columns available, you can use the below scripts. SELECT QUOTENAME([name]) + ',' as ColumnName, TYPE_NAME(user_type_id) as DataTypeName, * FROM tempdb. sys. columns WHERE OBJECT_ID = OBJECT_ID('tempdb..


1 Answers

All temp tables are logged under SQL server > Databases > System Databases > tempdb -> Temporary Tables

like image 105
TTeeple Avatar answered Oct 02 '22 18:10

TTeeple