Create a new sql table from a temp table when the fields in the temp table are unknown.

I have a temp table (#<temptablename>) in my code which contains about 50 fields. How can I create a permanent sql table from this temp table?
Lenny GrayAsked:
Who is Participating?
Aneesh RetnakaranConnect With a Mentor Database AdministratorCommented:
SELECT * into permanentTableName
FROM #tempTableName

this will create the table and populate the data
Jim HornConnect With a Mentor Microsoft SQL Server Developer, Architect, and AuthorCommented:
SELECT * INTO NewPhysicalTableName FROM #temptable
Lenny GrayAuthor Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.