SQL TRIGGER FOREACH LOOP
Posted on 2014-11-14
I am looking to create a sql trigger that on insert of record creates ultiple records and inserts them into another table.
Record 1234 gets inserted into table A
Then a trigger runs for after insert
It checks table B to see if record 1234 exists. If it does not then it inserts multiple items for Record 1234 such as
INSERT INTO TABLEB VALUES(1234, 'DOCUMENT A','Y');
INSERT INTO TABLEB VALUES(1234, 'DOCUMENT B','Y');
INSERT INTO TABLEB VALUES(1234, 'DOCUMENT C','Y');
Thanks in advanced.