HKFuey
asked on
SQL Trigger Syntax
Hi,
I have this trigger: -
I want it to fire when WarehouseToUse is not R or W.
When I click submit, I just get an hourglass, does anyone know where I'm going wrong?
I have this trigger: -
ALTER TRIGGER [dbo].[InvMasterSetOnHoldStatus]
ON [dbo].[InvMaster]
AFTER INSERT
AS
UPDATE dbo.InvMaster
SET StockOnHold = 'F'
, StockOnHoldReason = 'NEW'
WHERE StockCode in (SELECT StockCode FROM Inserted WHERE (WarehouseToUse <> 'R ' AND WarehouseToUse <> 'W '));
I want it to fire when WarehouseToUse is not R or W.
When I click submit, I just get an hourglass, does anyone know where I'm going wrong?
ASKER
Hi gplana Result is this: -
Msg 156, Level 15, State 1, Line 8
Incorrect syntax near the keyword 'OR'.
Msg 102, Level 15, State 1, Line 15
Incorrect syntax near 'END'.
Msg 156, Level 15, State 1, Line 8
Incorrect syntax near the keyword 'OR'.
Msg 102, Level 15, State 1, Line 15
Incorrect syntax near 'END'.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for the help on this.
Open in new window