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 |
|
Vack
Aged Yak Warrior
530 Posts |
Posted - 2011-12-07 : 12:21:51
|
I'm getting the message:Cannot use column prefix inserted. This must match the object in the update clause. How do I create the trigger so that only inserted records get the exp_cost updated?CREATE TRIGGER [UpdateCost1] ON [dbo].[SHIPDTL] for INSERTASupdate shipdtlset inserted.exp_cost = poordlin.exp_unit_costfrom poordlin join inserted on poordlin.ord_no = inserted.s_ord_no and poordlin.line_no =inserted.s_line_no and poordlin.item_no = inserted.s_item_no |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-12-07 : 12:27:44
|
| [code]CREATE TRIGGER [UpdateCost1] ON [dbo].[SHIPDTL] for INSERTASupdate sset s.exp_cost = p.exp_unit_costfrom poordlin pjoin inserted ion p.ord_no = i.s_ord_no and p.line_no = i.s_line_no and p.item_no = i.s_item_nojoin shipdtl son s.ord_no = i.s_ord_no and s.line_no = i.s_line_no and s.item_no = i.s_item_no[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|