sql - How to know how many times a record has been viewed (SELECTED)? -


i want implement feature show users how many times record has been viewed (been sql selected), don't know best way it. way can think of right recordid has been selected , use xml bulk update update view count. there better way or table design view count? thanks!

--------------- | recordid    | | recordvalue | | viewcount   |          --------------- 

i don't think level of auditing possible. however, can list of commands last 24 hours using query below. perhaps can run on regular basis string parsing functionality added.

select      querydate=execquery.last_execution_time,     sqlstring=execsql.text,     querycount=execution_count      sys.dm_exec_query_stats execquery     cross apply sys.dm_exec_sql_text(execquery.sql_handle) execsql order      execquery.last_execution_time desc 

Comments