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

Answers were Sorted based on User's Feedback



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

Answer / 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

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

Answer / rajdeep gupta

Hi there is a question copy only schema without data from
one table to another

INSERT INTO A1 select name,address from A2 WHERE 1 = 2

Is This Answer Correct ?    1 Yes 1 No

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

Answer / mohamed ibrahim

To Copy the data from one table to another table
for ex . i have the table named as TempMaster that having
the fields ID ,Name .The having the following record
ID Name
1 Raja
2 Mohamed

I want the same record copy to TempMasterArcheived table

to copy this using the following code:
INSERT INTO TempMasterArcheived
EXECUTE
('SELECT * FROM TempMaster ')

ID Name
1 Raja
2 Mohamed

after the output of TempMasterArcheived is as follows

Is This Answer Correct ?    0 Yes 0 No

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

Answer / gali kondareddy

INSERT INTO TABLE_2 SELECT * FROM TABLE_1


OR


INSERT INTO TABLE_2 SELECT * FROM TABLE_1 WHERE 1=1

Is This Answer Correct ?    0 Yes 0 No

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

Answer / abhik kumar basu

SELICT * INTO A1 FROM A2

Is This Answer Correct ?    0 Yes 0 No

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

Answer / rajeshbargode

we have to use INSERT INTO method.
with the use of this method we can easily transfer records
from one table to another table.we can not only use this
method in the same server but can aslo be done across the
server.for exmaple.if we have two table A1 and A2 then the
code is
INSERT INTO A2 select * from A2.

Is This Answer Correct ?    1 Yes 5 No

Post New Answer

More SQL Server Interview Questions

What is stored procedures?

0 Answers  


What does the not null constraint do?

0 Answers  


How can I create a new template for import ? : sql server management studio

0 Answers  


how to find number of columns in a table in sql server 2000 and 2005 also

7 Answers   HCL, Virtusa,


Why do you need a sql server?

0 Answers  






How to remove duplicate rows from table?

0 Answers  


Can we create SP inside SP ? If no Y ? If yes Y ? Explain with an example ?

3 Answers   IBM, L&T,


An employee table, with the columns id, name, sal and dob. Query to select emp names of all highest salaries(there are 4-5 people having the same salary which happens to be the highest).

9 Answers   ADP,


Is truncate autocommit?

0 Answers  


How many types of local tables are there in sql server?

0 Answers  


What is database replication? What are the different types of replication you can set up in sql server?

0 Answers  


how to determine the service pack currently installed on sql server? : Sql server database administration

0 Answers  


Categories