question

wish.mannat avatar image
wish.mannat asked

Sql Server auditing

Hi, I need to log the SELECT, INSERT DELETE and UPDATE statements that are executed on SQL. How can we do this? The closest I have is using the SQL trace file. It gives all the required data but the operation that the query is performing. SELECT * FROM ::fn_trace_getinfo(DEFAULT) FROM ::fn_trace_gettable('D:\TraceFileName.trc', default) But, what I specifically need is a column which contains one of the values from Select, Insert, Delete or Update depending upon the operation which the query was performing. Example an Update query might contain sub query that contains Select statement. So for this query I need Update operation in the column. Any suggestion will be appreciated.
sql serverauditlogging
1 comment
10 |1200

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

You would probably be better to investigate using SQL Server auditing: https://msdn.microsoft.com/en-us/library/cc280386.aspx depending on your needs. Are you looking to audit a specific table in a specific database? Or the entire database or the entire server?
1 Like 1 ·

0 Answers

· Write an Answer

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.