how to trace the effected table when a primary table is updated/inserted

  • Hi,

    When we update/insert any table how do we know which other tables are effected in sql server?

    If we are using SQL profiler how do we set it up?

  • hegdesuchi (11/3/2016)


    Hi,

    When we update/insert any table how do we know which other tables are effected in sql server?

    If we are using SQL profiler how do we set it up?

    The only way 'any other table' is going to be affected by an INSERT is if there is a trigger on the table. You can check this by scripting out the design of the table from SSMS.


  • Are you wanting to know what tables have a foreign key dependency on a table's primary key?

    You can use the following procedure call, specifying the primary key table.

    sp_depends '<object>'

    Also, you can go into SSMS Object Browser, drill down on the primary key table, and list object dependencies.

    "Do not seek to follow in the footsteps of the wise. Instead, seek what they sought." - Matsuo Basho

  • You should NOT be using SQL Profiler, which has been deprecated. You should be using extended events.

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply