Need Help With A Trigger

Need Help With A Trigger

 

  

I am attempting a trigger on a table. Data for this table is being imported from another db.
I want the trigger to replace the imported warehouse code with a different code.

I have this so far but it is not working:

Create trigger[WhseInsert} on dbo.Costing
For insert
AS
If(select WhseCode from inserted)='QON'
Update[Costing]
Set WhseCode = 'ZZZ'
Where ItemNumber in (select ItemNumber from inserted)

Syntax checks out but nothing happens.

Advice much appreciated.

Regards,

Justin



MS Sql Server LazyDBA home page