MsSQL – Copy Data from One Table to Another Existing Table

Today, there was a need to insert data from one table to another table. There are many ways to insert data from one to another. Sql server provides a functionality to copy data from one to another using SELECT clause also. I hope it may be helpful for you.

Syntax

[code:sql]

insert into <table name>
select <field list> from <table name from copy data>

[/code]

You can insert selected field also.

[code:sql]

insert into <table name> (field list)
select <field list> from <table name from copy data>

[/code]

Example

[code:sql]

insert into table2
select * from table1

insert into table2 (no,name,city)
select no,name,city from table1

[/code]