Search code examples
sql-serverdatabasedatabase-table

Where did my new table go


I have a database called mbt. I wanted to write some data from temporary table to real table.

--I used this query.

SELECT *  INTO new_table  FROM #tmp

when i runned the query it returned normal message.

15813 row(s) affected

After that i checked my tables in mbt database, but i couldn't see 'new_table'

how could such a thing be, where the table might have gone.

I may have forgotten to use 'use MBT' statment at the beginning of the query. Does it make problem

I'm using ms sql server 2014(SP2)(KB3171021)-12.0.5000.0(X64)

ANSWER

It gone to Master DB

select 'master' as DatabaseName, 
       T.name collate database_default as TableName 
from master.sys.tables as T 

Solution

  • It Will create a new table on your database. but you did not use so it will store in master database on your server.