CREATE TRIGGER SetCheckLimit
AFTER UPDATE OF LimitCount
ON accounts
FOR EACH ROW
WHEN ( (NEW.CheckLimit IS 1) AND
(NEW.Active IS 1) )
BEGIN
UPDATE accounts
SET LimitReached = 1
WHERE LimitCount >= MaxLimit;
END;