Search code examples
mysqlsqlansi-sql

Can I make a MySQL TEMPORARY TABLE non-temporary?


Is there a simple ALTER TABLE that will allow this, or should I simply CREATE ... LIKE ...; ... INSERT SELECT?


Solution

  • Temp tables live in tempdb, not your data files, so you're gonna have to recreate it there. Try:

    SELECT * INTO MyTable FROM #tempTable