I am new to sql server. I would like help from you gurus out their. I wanted to audit the activites (DML) on my database. I wanted the audit to achive the following
1] Audit specific tables for the DML activities.
2] capture the details of the username, time and system from which this query executed.
3] Can i get the changed and the previous values.
4] I don't want to use the triggers.
I did read in some articles this is achivable with the help of SQL-profiler and osql but don't know the exact steps. Could some one provideme with the step by step guide to get this done?
Without triggers it is not very easy. Triggers can meet your exact requirement.
As you mentioned you can use Profiler tool which is UI based Tool but again you cannot query without saving them to table, moreover you cannot get old value.
Contact me at firstname.lastname@example.org (Messenger) for further questions,
Why not use triggers? The DDL triggers are designed for this.
If you switch c2 audit on then you will hit most requiements and get a lot more besides. Problem with previous values I think.
You mean DML triggers. DDL triggers monitor for changes to the schema and objects themselves.
As to the original question, there are two options:
Of these two options, triggers are probably the best fit. Server traces will tell you the query, who executed it, and when they executed it, but it can't return the information on what the original values were. That's going to require a trigger. Triggers have special tables that are used depending on the operation:
You're not going to get this information via any other built-in means.