SQL Server Monitor Data Inserts, Updates and Deletes from Legacy Application

Viewed 442

We currently have a legacy desktop application that uses SQL Server 2014 as the database. We would like to add some additional features outside of the software which we don't have the source code to.

How can we monitor what data is inserted, updated or deleted to different tables in the database when a certain task is completed in the desktop software? This would allow us to add data to the database in the same way that the desktop application is currently doing it.

We have tried SQL Profiler but can't seem to get the information.

Is there a way to get a differential between two points in time from one database?

2 Answers

You can use the trigger which are executed automatically in response to Create,Update,Delete.you can create the triggers for each table and it will give you the required information

CREATE TRIGGER [schema_name.]trigger_name
ON table_name
AFTER  {[INSERT],[UPDATE],[DELETE]}
[NOT FOR REPLICATION]
AS
{sql_statements}
We have tried SQL Profiler but can't seem to get the information

^ This is the correct course of action. Triggers will only show you the end result of queries, not what queries are actually run - there may be calculations, intermediate steps etc.

When you say you 'can't seem to get the information', what exactly do you mean? Profiler will be able to show you the text of all queries ran against the SQL Instance

Related