I have to check before inserting or updating a certain relation whether a particular row attribute in relation A is equal or greater than a corresponding row attribute in relation B. I wrote a trigger:
Attempt:
CREATE TRIGGER CandyCons AFTER INSERT, UPDATE ON Rel_A
AS
IF EXISTS (
SELECT * FROM Rel_A A, Rel_B B WHERE A.ID = B.ID AND A.candy > B.too_much
)
BEGIN
RAISERROR ('Stop eating!', 16, 1);
ROLLBACK TRANSACTION;
RETURN;
END;
I can't execute this. When I run it, I start getting line numbers like:
query
12
13
14
15
......... and so on
What should I do?