How to determine how many tables are affected in the database after inserting a record?

A one-way application stores data in a huge database (SQL Server 2000/2005). This database contains more than 80 tables. How do I know how many tables are affected when an application stores a new record in a database? Is there something available I can get a list of affected tables?

+3
source share
5 answers

Perhaps you can tell by running a trace in the SQL Profiler in the database - the SQL: StmtCompleted event probably tracks - that is, if the application does a series of inserts into several tables, you should see that they pass through Profiler.

+3
source

You can use SQL Profiler to track SQL queries. Thus, you will see a sequence of calls caused by a single click in your application.

Also, use can use metadata or SQL tools to get a list of triggers that can do a lot of things with a simple insert.

+2
source

- , , .

, , . , , , , . , , .

0

If you have an SQL script that was used to store the new record (usually it should be an insert statement or another DML statement, such as updating, merging, etc.). Then you can find out how many tables affected the parsing of these SQL scripts.

Take this SQL for example:

Insert into emp(fname, lname)
Values('john', 'reyes')

You can get the result as follows:

sstinsert
 emp(tetInsert)

Tables:
emp

Fields:
emp.fname
emp.lname
0
source

Source: https://habr.com/ru/post/1730077/


All Articles