June 20, 2018 at 6:53 am
Morning Guys,
I wish to enable change data capture for a handful of tables, though I only want to audit/log when a specific user performs an update.
During general usage where this particular maintenance user is disabled I do not want to log any actions. But on the weekends when that user becomes active I want to only record any changes that he makes.
Some other out of scope users may also be doing work at the same time, but I only want to focus on MrMaintenance.
Is this possible with CDC? I am trying to avoid the trigger route.
Cheers
Alex
June 20, 2018 at 7:25 am
alex.sqldba - Wednesday, June 20, 2018 6:53 AMMorning Guys,I wish to enable change data capture for a handful of tables, though I only want to audit/log when a specific user performs an update.
During general usage where this particular maintenance user is disabled I do not want to log any actions. But on the weekends when that user becomes active I want to only record any changes that he makes.
Some other out of scope users may also be doing work at the same time, but I only want to focus on MrMaintenance.
Is this possible with CDC? I am trying to avoid the trigger route.
Cheers
Alex
It is kind of possible, CDC is an all or nothing way of collecting data. You can easily have a job that will then copy the data you require to another table to just audit what you need. As you will be reading from the CDC tables and not the live, I don't see this being much of an issue.
In your case though, you might be better off with a trigger based on the user.
June 20, 2018 at 8:28 am
The reason I didn't want triggers is firstly, this a vendor app and whilst we have control over the SQL Server, we can't get into the guts of the application itself. So any Errors as result of the trigger interfering with something wont be able to be handled or worked out from the application layer. So I was hoping for something transparent to the application.
When you say CDC is an all or nothing approach - what do you mean?
June 21, 2018 at 9:43 am
CDC can't filtered by user. It's a system process capturing changes on the table level from the log.
June 22, 2018 at 2:20 am
Cheers Joe.
June 22, 2018 at 6:58 am
alex.sqldba - Wednesday, June 20, 2018 8:28 AMThe reason I didn't want triggers is firstly, this a vendor app and whilst we have control over the SQL Server, we can't get into the guts of the application itself. So any Errors as result of the trigger interfering with something wont be able to be handled or worked out from the application layer. So I was hoping for something transparent to the application.When you say CDC is an all or nothing approach - what do you mean?
Heh... so write error free triggers. 😉
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply