Click here to Skip to main content
15,893,564 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello...
Please suggest me , how to insert data from table1 to table2, I don't have an error because i have the result that an incorrect.
I have the sample result please click the like bellow..
http://terzasek.judlook.com/problem.jpg[^]
Thank you -/\-
Posted
Updated 4-Apr-14 1:16am
v2

 
Share this answer
 
Comments
terzasek 4-Apr-14 8:18am    
OMG!! Just easy... but i don't know!!
Thank you very much!!
Hi
you just use the below script

SQL
INSERT INTO table2
(column_name1,2,3..)
 SELECT column_name1,2,3..)
 FROM table1;


Column tyes in both tables should be matched.

Thanks,
-RG
 
Share this answer
 
Comments
terzasek 4-Apr-14 8:20am    
Oh! unforeseen...
It very easy but i does't work...
Thank you very much.
Ramug10 4-Apr-14 8:28am    
You most welcome...:)
Working Solution:

SQL
INSERT INTO table1 (col1, col2, col3)
SELECT Col1, Col2, Col3 FROM table2
 
Share this answer
 
Comments
terzasek 4-Apr-14 8:21am    
Thank you. now, i can working..^ ^
We can copy all columns into the new table:
SQL
SELECT *
INTO newtable --any new talbe name
FROM table1;
 
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