CREATE TRIGGER tr_person_setPersonID ON person AFTER INSERT AS DECLARE @newid int SET @newid = (select max(P.person_id) + 1 FROM person P JOIN inserted i ON i.study_id = P.study_id WHERE p.study_id = ...
I'm having trouble figuring out how to write a particular trigger to avoid having it recurse. This trigger is an after update trigger that operates on the same table that fires it. This is a database ...