Sql-server – Auditing user queries of specific rows in a table

auditsql server

Is it possible in SQL Server 2017 and upwards to audit the access to certain rows in a table? Imagine a customer table, and we wanted to track when users selected the data for premium customers identified by their primary key; or maybe employees querying the salary information of their fellow employees (but not too worried about them querying their own salary information).

With the wealth of auditing and security technologies that Microsoft are throwing at SQL Server these days, is there anything among e.g. extended events, row level security, auditing etc that would help me?

Best Answer

Wouldn't it make more sense to set the permissions so they can only access the things they are authorised to rather than audit and log that they did something unauthorised - that said:-

I think if you built 2 views which filtered the base tables to "sensitive" and "normal" rows and only permitted access via the views you could then audit the views.