Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
@NJohnson9402

This comment has been minimized.

Copy link
Owner Author

@NJohnson9402 NJohnson9402 commented May 5, 2018

See full repo @ https://github.com/NJohnson9402/Demo-Audit-Delete-Trigger/ ; this is merely broken-out for ease of blogging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment