views:

60

answers:

4

One third party app is storing data in a huge database (SQL Server 2000/2005). This database has more than 80 tables. How would I come to know that how many tables are affected when application stores a new record in database? Is there something available I can retrieve the list of tables affected?

A: 

you can add triggers on tables that get fired on update - you could use this to update a log table that would report what was being updated.

see more here: http://www.devarticles.com/c/a/SQL-Server/Using-Triggers-In-MS-SQL-Server/

Josh
Am i going to add triggers to all 80 tables? Since data is entered by Third party tool, I just need to know when one record is inserted in how many tables out of 80 tables?
Novice
+2  A: 

You might be able to tell by running a trace in SQL Profiler on the database - the SQL:StmtCompleted event is probably the one to monitor - i.e. if the application does a series of inserts into multiple tables, you should see them go through in Profiler.

AdaTheDev
+2  A: 

You can use SQL Profiler to trace SQL queries. So you will see sequence of calls caused by one button click in your application.

Also use can use metadata or SQL tools to get list of triggers which could make a lot of actions on simple insert.

A: 

Profiler is the way to go, as others have said especially with an unfamilar third party database.

I would also spend some time creating diagrams so you can see the foreign key relationships and understand how the database is put together. I usaully know my database structure so well, I can tell from the fields being inserted what tables they affect and I know what triggers are on my tables and what they affect. There is no substitute for taking the time to understand the database you support.

HLGEM
i got your point too. Thanks
Novice