catchup
07-10-2006, 11:57 AM
Hi i'm about to embark on my first trigger. I have an table 'Inventory' that needs two columns populated from the 'Products' table when Inventory is Created and Updated. This is what i have so far which is giving me an error of incorrect syntax 'inv'
This is what i have, thanks:
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TRIGGER Schema_Name.inventory_tgr
ON Schema_Name.Inventory
AFTER INSERT,UPDATE
AS
BEGIN
SET NOCOUNT ON;
update Inventory inv set inv.GDS = i.GDS, inv.ProdID = i.ProdId
from inserted i where inv.ProductID = i.ProductID
END
GO
This is what i have, thanks:
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TRIGGER Schema_Name.inventory_tgr
ON Schema_Name.Inventory
AFTER INSERT,UPDATE
AS
BEGIN
SET NOCOUNT ON;
update Inventory inv set inv.GDS = i.GDS, inv.ProdID = i.ProdId
from inserted i where inv.ProductID = i.ProductID
END
GO