Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
dcarva
Posting Yak Master
140 Posts |
Posted - 2003-04-30 : 11:47:10
|
| Hello,I have two tables with the following schema:Table1: (col1, col2, col3)Table2: (col1, col2)I have a stored procedure that LOOPS through all rows in table 1 and copies Table1.col1 to Table2.col1 and Table1.col3 into Table2.col2 using an insert statement within the loop. Is there a better way to do this? I tried using the SELECT INTO but SELECT INTO wants to create a new table. Table2 already exists and has data. Is the loop (the way I am currently doing this) the most efficient way to achieve this?Thanks in advance,Danny |
|
|
Page47
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2003-04-30 : 11:56:36
|
| insert table2(col1,col2)select col1,col3 from table1Jay White{0} |
 |
|
|
dcarva
Posting Yak Master
140 Posts |
Posted - 2003-04-30 : 11:59:46
|
| Thank you! So much simpler than what I was doing. |
 |
|
|
|
|
|