Click here to Skip to main content
15,885,985 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how i insert 1 row
from 1 table to another table
Posted

SQL
INSERT Table2
(columnX, columnY)
SELECT column1, column2 FROM Table1
WHERE [Conditions]
 
Share this answer
 
v2
Comments
Surendra0x2 22-Feb-13 2:03am    
I was about to Edit solution thanks for Editing Amit :)
_Amy 22-Feb-13 3:11am    
Welcome. :)
You can use
SQL
insert into tbl_test1 (col1,col2,col3)
(select col_1,col_2,col_3 from tbl_test)


OR

insert into tbl_test1 select col1,col2,col3 from tbl_test
(here is one condition that Columns has to be same as tbl_test)

But, If you want to insert only one row then,
you can apply condition to select query.
 
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