I have the following trigger, this line:
if (Select ins.Status from inserted ins) = 'V'
will work only if the select returns one row. If the select return more than one row, it doesn't not work. Would you please help me rewrite this "if" statement so it can work with multiple rows. Thank you very much for your help.
CREATE TRIGGER ApproverReview ON PER_CONTROL
FOR INSERT, UPDATE
AS
if Update(status)
if (select count(*) from inserted, deleted where inserted.Status = deleted.Status) = 0
if (Select ins.Status from inserted ins) = 'V'
BEGIN
UPDATE PER_COMP_ANCHOR_COMMENTS
set evaluator_code = 'B', UPDATE_ID = 'SYSTEM'
where evaluator_code = 'R' and
cntrl_number in (Select ins.per_cntrl_nbr from inserted ins)
END