Click here to Skip to main content
15,881,381 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
copy data from table 1 to table2


table 1

p_name ppo_no acc_no

tanu    1235   356986




table 2
p_name ppo_no acc_no

roshan  3265   45896
yogi    7895    46589


i want to copy the data of table1 to table2
results
p_name ppo_no acc_no

roshan  3265   45896
yogi    7895    46589
tanu    1235   356986
Posted
Updated 19-Oct-14 21:45pm
v2

 
Share this answer
 
You should try on google first. Anyway her is the answer

SQL
INSERT INTO [table 1] (p_name, ppo_no, acc_no)
SELECT p_name, ppo_no, acc_no FROM [table 2]
 
Share this answer
 
Hi,


Try this...

SQL
--both table structure should match

insert into table2
Select * from table1

--or

insert into table2 (p_name, ppo_no, acc_no)
Select p_name, ppo_no, acc_no from table1


It is also advisable that you must go through the link given in Solution 1 to get detailed knowledge.

Hope this will help you.

Cheers
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900