472,142 Members | 1,113 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,142 software developers and data experts.

Copying a table with different column names

Hi,

I want to copy a table in my SQL server from one database to another. during this migration, I also want to change the name of the columns. Please advise me how to go about it.

Thanks
Mar 5 '08 #1
1 1302
ck9663
2,878 Expert 2GB
Hi,

I want to copy a table in my SQL server from one database to another. during this migration, I also want to change the name of the columns. Please advise me how to go about it.

Thanks
Try something like :

Expand|Select|Wrap|Line Numbers
  1. select column1 as newcolumn1, column2 as newcolumn2, column3 as newcolumn3  into db2..table2
  2. from db1..table1
-- CK
Mar 6 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

6 posts views Thread by Margaret MacDonald | last post: by
36 posts views Thread by toedipper | last post: by
4 posts views Thread by Gordon Burditt | last post: by
1 post views Thread by Jens Riedel | last post: by
8 posts views Thread by brian kaufmann | last post: by
7 posts views Thread by Serge Rielau | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.