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 |
|
Teachme
Starting Member
45 Posts |
Posted - 2007-08-22 : 16:11:07
|
| i have 2 tables t1(id1, id2) and t2(id).t1 data: 100 101200 101300 101t2 data:100200400I need to update t2(IDs) to id2 of t1 based on id1 of t1 meaning t2 would become 101,101, 400 (in other words update (t2.id) to (t1.id2) wherever t1.id1 = t2.id). These are jus a few rows the actual data is much more so i'm not sure if i use a while loop how do i do it or would a cursor be a better option and how. Thanks for any kind of help. |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-08-22 : 16:14:03
|
update t2set t2.id = t1.id2from t2inner join t1 on t1.id1 = t2.id E 12°55'05.25"N 56°04'39.16" |
 |
|
|
Teachme
Starting Member
45 Posts |
Posted - 2007-08-22 : 16:20:16
|
| i was thinking way over on that one. thanks |
 |
|
|
|
|
|