In SQL Server, is possible trigger an event based on a SELECT condition in another table?
Let's imaging this trigger in TABLE_1:
FOR INSERT AS
BEGIN
INSERT INTO TABLE_2 (ID, COD_CAT) SELECT COD_ART,'X3' FROM INSERTED
This trigger works fine and always.
I would like trigger that insert event only if INSERTED.COD_ART is not already existing in TABLE_2.
Any idea?
Aucun commentaire:
Enregistrer un commentaire