SQL Server insert with loop

I need to insert records into a table in SQL Server 2008. I want to insert the records from an existing table. So for each record in table1, insert that record into table2. The tables are not exact matches. I want to copy the correct data into the new table. What would be the best way to do this?
dodgerfanAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Ephraim WangoyaConnect With a Mentor Commented:


insert into table2 (col1, col2, col3, ...)
select col1, col2, col3, ...
from table1
0
 
dodgerfanAuthor Commented:
Perfect, thanks.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.