How to a Query to copy data from on table to another table.

Answer Posted / dhiraj kumar

we have to use INSERT INTO method.
with the use of this method we can easily transfer records
from one table to another table but both table should have
similar columns or you need to select same no of columns
and datatype as inserting table

example:table A1 having 2 columns emp_name,emp_address
and A2 having 4 column name,address,city,dept

INSERT INTO A1 select name,address from A2.

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Tell me what are cursors and when they are useful?

511


How to get a list of columns using the "sp_help" stored procedure in ms sql server?

584


what types of replication are supported in sql server? : Sql server database administration

466


How is SQL Azure different than SQL server?

92


How can we check the sql server version?

567






What is abstracting periodical?

529


What is change tracking in sql server?

548


Do you know what is a linked server in sql server?

550


How to create a view on an existing table in ms sql server?

593


Is there any performance difference between if exists (select null from table) and if exists (select 1 from table)?

527


What is difference between count (*) and count column?

525


What are .mdf files?

522


What is the command used to recompile the stored procedure at run time?

622


Which tools are available to manage SQL Azure databases and servers?

93


What is a dataset and what are the different types of datasets?

93