Trigger_AfterDelete_LogEvidence
CREATE OR ALTER TRIGGER dbo.Victims_DEL | |
ON dbo.Victims | |
AFTER DELETE | |
AS | |
BEGIN | |
INSERT INTO aud.Evidence (SchemaName, TableName, ActionType, RecordID | |
, DatabaseUser, ServerLogin, ActionTime) | |
SELECT SchemName = 'dbo', TableName = 'Victims', ActionType = 'delete', RecordID = Deleted.Id | |
, DbUser = USER_NAME(), SrvLogin = SUSER_SNAME(), ActionTime = SYSDATETIME() | |
FROM Deleted; | |
END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
See full repo @ https://github.com/NJohnson9402/Demo-Audit-Delete-Trigger/ ; this is merely broken-out for ease of blogging.