Sqlserver
 sql >> Base de données >  >> RDS >> Sqlserver

Déclencheur SQL Server ON DELETE

CREATE TRIGGER sampleTrigger
    ON database1.dbo.table1
    FOR DELETE
AS
    DELETE FROM database2.dbo.table2
    WHERE bar = 4 AND ID IN(SELECT deleted.id FROM deleted)
GO