Click here to Skip to main content
Click here to Skip to main content

Tagged as

Go to top

Copy paste complete Table SQL Server

, 16 Dec 2011
Rate this:
Please Sign up or sign in to vote.
Using a very simple query we can make replica of existing table along with full data and datatypes
There is a pretty nice method available to transfer data from one table to another
 
Transfer data from existing table to new table:
select * into table2 from table1
Copy all data from table1 into table2 (it creates new table2 no need to write create statement)
 
It will create new table2 and transfer all data from table1 to table2
 
Transfer data from existing table1 to existing table2:
 
If you want to transfer data from one table to existing table2 then use
Insert into vt_FE_Role1
Select [Role] from vt_FE_Role
Do not include primary key column if it is set as identity. Otherwise you can use it.
You must take care of RDBMS if exists.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

UmairAslam
Technical Lead
Pakistan Pakistan
MCP
Follow on   Twitter   Google+   LinkedIn

Comments and Discussions

 
GeneralReason for my vote of 1 sql basics not tip PinmemberSelvin17-Dec-11 4:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web04 | 2.8.140926.1 | Last Updated 16 Dec 2011
Article Copyright 2011 by UmairAslam
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid