Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2013-06-24
3
Medium Priority
?
368 Views
Last Modified: 2013-06-24
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?
0
Comment
Question by:Lenny Gray
3 Comments
 
LVL 75

Accepted Solution

by:
Aneesh Retnakaran earned 1000 total points
ID: 39272989
SELECT * into permanentTableName
FROM #tempTableName

this will create the table and populate the data
0
 
LVL 66

Assisted Solution

by:Jim Horn
Jim Horn earned 1000 total points
ID: 39272991
SELECT * INTO NewPhysicalTableName FROM #temptable
0
 

Author Closing Comment

by:Lenny Gray
ID: 39273237
Thanks!
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Long way back, we had to take help from third party tools in order to encrypt and decrypt data.  Gradually Microsoft understood the need for this feature and started to implement it by building functionality into SQL Server. Finally, with SQL 2008, …
This is basically a blog post I wrote recently. I've found that SARGability is poorly understood, and since many people don't read blogs, I figured I'd post it here as an article. SARGable is an adjective in SQL that means that an item can be fou…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

877 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question