Log who deleted a row using Change Data Capture

964 views Asked by At

I have SQL 2014 Enterprise and have configured Change Data Capture (CDC). I have UserId columns on all of my tables. So CDC does a great job seeing who inserted and updated a row but if someone deletes a row I cant see who deleted the row (it has the previous UserId in the row). I know Oracle has this feature included in their CDC package.

1

There are 1 answers

0
JoshGivens On

Create a trigger after delete which stores the userid of whoever deleted the data. you'd want to have a table setup that has restricted access, likely to the admin, to store the information.