Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Trigger

Author  Topic 

Steve2106
Posting Yak Master

183 Posts

Posted - 2012-03-16 : 06:47:49
Hi There,

Is there a way I can write to a table every time a certain table is accessed.

Is there an "ON READ" for a trigger?

I have a desktop app that uses a MS SqlServer for the backend files. When the program first loads it reads from a table and then opens the program. I want to capture each time this table is read.

Is that doable?

Thanks for your help.

Best Regards,



Steve

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-03-16 : 08:36:38
quote:
Originally posted by Steve2106

Hi There,

Is there a way I can write to a table every time a certain table is accessed.

Is there an "ON READ" for a trigger?

I have a desktop app that uses a MS SqlServer for the backend files. When the program first loads it reads from a table and then opens the program. I want to capture each time this table is read.

Is that doable?

Thanks for your help.

Best Regards,



Steve

There is no "ON READ" trigger.

The immediate thought that comes to mind is to encapsulate the data access via a stored procedure and do the logging/auditing you need to do within the stored proc. That would mean that the client application will need to call the stored proc rather than doing an ad-hoc query against the table (which is a good idea regardless of the need to audit).
Go to Top of Page

Steve2106
Posting Yak Master

183 Posts

Posted - 2012-03-16 : 09:10:15
Hi Sunita,

Thanks for the info.

Best Regards,

Steve
Go to Top of Page
   

- Advertisement -