Question

Is there anyway to audit a SQL table where you can get information such as what application is writing to it and when it writes to it?

There are a bunch of applications users are using here and I have combed through each on and cannot find where any of them write to this one table in SQL Server. And it's an important table.

It's driving me crazy.

Was it helpful?

Solution

You have to set up auditing from the start (usually through triggers that write to audit tables that include the user or application that is writing to the table). There is no way to find this information for past data if you did not have auditing designed into your system.

When you set up the audtitables you might want to include fields that are populated by these system variables:

suser_sname(), host_name(), app_name(), getdate()

OTHER TIPS

If you know the exact time it is happening you can catch them in the act using sp_who2 or sp_whoisactive type procedures that return lots of useful information about currently running processes.

However, it sounds like you cannot foresee this activity so I would suggest running a SQL Profiler trace and filter on the database and table in question. Be sure to capture the events that will help you finger the responsible party (LoginName, HostName, etc.). There are countless articles on the Net that walk you through a simple trace.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top