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 |
|
esthera
Master Smack Fu Yak Hacker
1410 Posts |
Posted - 2005-09-09 : 02:45:50
|
| I'm trying to loop through my table and update a field based on looking up a value in another table.... I want to do something that loops through all the records in my table (dtstates$) looking up to table numbertypeI thought somethign like this but my syntax is wrongupdate dtdates$ set dtdates$.numbertypeid=select numbertypeid from numbertype where numbertype.type= dtdate$.typeI want this to happen per record in dtdates$ |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-09-09 : 02:51:31
|
| Before trying this query, take a backup of those two tablesIf the updation is wrong restore themupdate T1 set T1.numbertypeid=T2.numbertypeid from dtdates$ T1 inner join numbertype T2 on T1.type= T2.typeMadhivananFailing to plan is Planning to fail |
 |
|
|
esthera
Master Smack Fu Yak Hacker
1410 Posts |
Posted - 2005-09-09 : 06:42:11
|
| thanks worked perfect |
 |
|
|
|
|
|