Click here to Skip to main content
15,887,596 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
Hello friends,

I am using SQL server2005. In my database i have two tables say table1 and table2. table1 have 10 columns and table2 have 15columns here i want to create a stored procedure in which i want to copy all 10columns data of table1 to table2 and remaining 5 columns of table2 would get some other external data such as date.etc.

I don't know how to copy and hold table1 data and then add to table2 with other 5 columns data.

Can anybody guide me for same.

Thanks in advance.
:-)
Posted

1 solution

Do a Insert Into based on a select
so:
SQL
Insert Into table2
 (col1, col2, col3...col10)
SELECT col1, col2, col3...col10
FROM table1
 
Share this answer
 
Comments
saj_21 9-Feb-12 4:11am    
and how to insert remaining 5 columns data????

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