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 |
|
vicpal25
Starting Member
21 Posts |
Posted - 2007-11-28 : 18:39:05
|
| I have an UPDATE statement that is trying to update records from two different tables. I am getting an error that tells me:'Cannot use the column prefix 'B'. This must match the object in the UPDATE clause 'A'.'Does this mean I can only update tables from one table using the inner joined table?Do I need to create two update statements? Here is my T-SQLUPDATE ASET A.Item_No = '2342-12',A.Dsc = 'Testing Description',B.Series_Ltr = 'B'B.Rev_Ltr = NULL, B.Begin_Eff_Dt = NULL,B.End_Eff_Dt = NULL,B.Build_UM = NULL,B.Procurement = NULL,B.Prepared_By = NULL,B.Checked_By = NULL,B.Release_Dt = NULL,B.Remarks = NULL,FROM ENGR_ITEM AINNER JOIN Engr_BOM_Control BON A.pEngr_Item_ID=B.fEngr_Item_IDwhere A.pEngr_Item_ID = '6040' |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2007-11-28 : 18:50:39
|
| Yes you need two update statements.UPDATE ASET Item_No = '2342-12',Dsc = 'Testing Description',FROM ENGR_ITEM AINNER JOIN Engr_BOM_Control BON A.pEngr_Item_ID=B.fEngr_Item_IDwhere A.pEngr_Item_ID = '6040'UPDATE BSET Series_Ltr = 'B'Rev_Ltr = NULL, Begin_Eff_Dt = NULL,End_Eff_Dt = NULL,Build_UM = NULL,Procurement = NULL,Prepared_By = NULL,Checked_By = NULL,Release_Dt = NULL,Remarks = NULL,FROM ENGR_ITEM AINNER JOIN Engr_BOM_Control BON A.pEngr_Item_ID=B.fEngr_Item_IDwhere A.pEngr_Item_ID = '6040'Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/ |
 |
|
|
vicpal25
Starting Member
21 Posts |
Posted - 2007-11-28 : 19:13:08
|
| Sweet. Thanks for the help! |
 |
|
|
|
|
|
|
|