IF (@max_vendor != (SELECT vendor_id FROM Inserted)) BEGIN RAISERROR ('PO already exists with a different vendor',16,1) ROLLBACK TRAN END