question

g_yerden avatar image
g_yerden asked

Column Name Only Insert

I want to be able to grab the column names from a table with a lot of columns and throw it into a new table without all the data. I tried some stuff but have been getting syntax errors... Select Top 1 Into NEWTABLE from OLDTABLE CREATE TABLE (SELECT Top 1 From OLDTABLE) I thought there was a way to do this, I just cant seem to find it. Thanks for the help!
inserttablecreate
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

· Write an Answer
JohnM avatar image
JohnM answered
You should be able to do this: SELECT TOP 0 * INTO dbo.NewTable FROM dbo.OldTable GO
2 comments
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

thank you!
0 Likes 0 ·
Very welcome! Glad it helped solve your issue!
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.