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 |
|
trackjunkie
Starting Member
31 Posts |
Posted - 2009-11-06 : 12:03:56
|
| I have a table "Weights" with columns "F1" and "F2". I have another table "item" with columns "item" and "unit weight"Any place "Weights.F1" is equal to "item.item" I want to set "item.unit_weight" equal to "Weights.F2"I am trying the follwoing:Insert into item(unit_weight)Select (F2) from WeightsWhere item.item = Weights.F1I get: The multi-part identifier "item.item" could not be bound.Am I even close to going about this the right way.i had a post on this yesterday but did not explain things well, so sorry for reposting a topic.... |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2009-11-06 : 12:28:42
|
| It looks like you want to overwrite existing data, so an UPDATE is in orderUPDATE iSET i.unit_weight =w.F2from item iinner join Weights won i.item = w.F1JimEveryday I learn something that somebody else already knew |
 |
|
|
trackjunkie
Starting Member
31 Posts |
Posted - 2009-11-06 : 13:53:29
|
| Ok, tried the update code provided by the last poster and it ran but effected zero rows. So I wrote a select statement:Select item.item from iteminner joinWeightsonitem.item = Weights.F1To test if the connection was being made and no rows were returned.The columns are of the same type and there are definitly many shared values. What am I missing? |
 |
|
|
trackjunkie
Starting Member
31 Posts |
Posted - 2009-11-06 : 15:01:07
|
| Never mind, i'm an idiot. It worked perfectly. Thanks. |
 |
|
|
|
|
|