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 |
|
craigmacca
Posting Yak Master
142 Posts |
Posted - 2009-03-11 : 12:44:42
|
| Hi i have a table "copyTable" with 2 columns "id" and "add_1"i need to update another table "testTable" and update1. loop through "copyTable"2. update "testTable"3. set "testTable.add_1" = "copyTable.add_1"4. where "testTable.Id" = "copyTable.Id"just not sure how to do this in a stored proc? |
|
|
guptam
Posting Yak Master
161 Posts |
Posted - 2009-03-11 : 12:50:15
|
| UPDATE testTable SET testTable.add_1 = copyTable.add_1 FROM copyTable WHERE testTable.ID = copyTable.IDThanks.-- Mohit K. GuptaB.Sc. CS, Minor JapaneseMCITP: Database AdministratorMCTS: SQL Server 2005http://sqllearnings.blogspot.com/ |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-03-11 : 13:16:49
|
use inner joinUPDATE ttSET tt.add_1 = ct.add_1FROM testTable ttINNER JOIN copyTable ctON tt.ID = ct.ID |
 |
|
|
|
|
|