I am dealing with some sensitive Accounting tables and I would like to audit any SELECT statement executed on the table or any views associated with them.
I did not find any DDL Events on BOL (Books Online) that had anything to do with SELECT statement.
And DML triggers are for INSERT, UPDATE and DELETE only.
Is it possible to log who accesses table and views through SELECT statement?
You have 3 options:
I’d go for options 1 or 2 because they are part of your application and self contained.
Although, this does sound a bit late to start logging: access to the table should have been restricted up front.
Also, any solution fails if end users do not correct directly (eg via web server or service account). Unless you use stored procs to send in the end user name…
View example: