Link to home
Start Free TrialLog in
Avatar of HKFuey
HKFueyFlag for United Kingdom of Great Britain and Northern Ireland

asked on

SQL Trigger Syntax

I have this trigger: -
    UPDATE dbo.InvMaster
       SET StockOnHold = 'F'
         , StockOnHoldReason = 'NEW'    
     WHERE StockCode in (SELECT StockCode FROM Inserted);

Open in new window


One of the fields inserted is 'WarehouseToUse' (Char(2)),  If the entry in this field is 'B ' I don't want the trigger to fire. Does anyone know the syntax?
SOLUTION
Avatar of Lee
Lee
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of HKFuey

ASKER

This worked for me: -
 WHERE StockCode in (SELECT StockCode FROM Inserted WHERE WarehouseToUse <> 'B ');

Thanks for super quick response!!