question

Troy_2012 avatar image
Troy_2012 asked

CDC 2012- how to know the user that he change or delete data

Dear all, Is there a possibility to find out who is the login user **who** change,add, or delete data in CDC with SQL Server 2012?
sql-server-2012change-data-capture
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Magnus Ahlkvist avatar image
Magnus Ahlkvist answered
I'm far from an expert with CDC, but as far as I've found out, you cannot use CDC to track who made the change. With insert and update, you can create a workaround by adding a column LastChangedBy and have your system update that column with whoever made the change. Then you'll keep track of each change to a row by following the changes with CDC. With deletes, that workaround won't help you. In other words - CDC isn't there to help you with tracking who made a change to the data. The workarounds aren't complete. So you're probably better off tracking these changes on your own, using triggers or whatever technique you choose.
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.