Home > Software design >  Table exists but doesn't appear SQL Server
Table exists but doesn't appear SQL Server

Time:02-27

I've used the query

SELECT TOP (1000000) ROW_NUMBER() OVER (ORDER BY (SELECT 1)) AS N
INTO #Tally3

and it worked. But I can't find the table #TALLY3 in SQL Server, even after refreshing.

What is weird is that after executing

SELECT * 
INTO test 
FROM table1

the table test did appear and I was able to see it.

What's even weirder,

SELECT * FROM #TALLY3

works now even though it doesn't appear and SQL Server underlines #TALLY3 in red because it thinks it doesn't exist:

enter image description here

Can someone help me?

Thanks!

CodePudding user response:

That's a #temporary table. It's created in tempdb, not your user database. You're not going to find it in Object Explorer, and it's only visible in the query window that created it. It will disappear when that session ends.

  • Related