Identify tables dependencies ?

  • I'm new in SQL server,

    and my question is...

    I was asked to identify the master table and the slave tables correlated in a large database with more than 100 tables.

    I mean ...in the case of 3 tables (a,b,c), table (a) has a primary key linked to table (b), and this one is linked with table (c).

    In this case is easy to identify the master table....---> a, and slaves b, and c, but in a large database ? Dependencies are to complicate.

    Is there a tool (also third party), or T-Sql procedure, scripts...which answers to my question (any tools can resolve dependencies)?

    I have tried to use the diagram provided by SQL Manager, but is impossible to undestand any table correlations.

    In the case of SQL Server diagram, how can I undearstand dependencies between tables?

    Thank to everybody, any help will be appreciated....

  • Not sure did I correctly understand, but there are some procs:

    sp_help

    sp_depends

  • Hi there is an undocumented stored procedure called 'sp_MSdependencies ' take a look below for usage examples.I think it will work for u.

    sp_MSdependencies — First level only

    -- Objects that are dependent on the specified object

    EXEC sp_MSdependencies N'[dbo].[Customer]', null, 1315327

    -- Objects that the specified object is dependent on

    EXEC sp_MSdependencies N'[dbo].[Customer]', null, 1053183

     sp_MSdependencies - All levels

    -- Objects that are dependent on the specified object

    EXEC sp_MSdependencies N'[dbo].[Customer]', null, 266751

    -- Objects that the specified object is dependent on

    EXEC sp_MSdependencies N'[dbo].[Customer]', null, 4607

    Dincer Uyav

    TeknaInternational

     

     

  • Thank to everybody,

    I 'll try the sp:

    sp_MSdependencies, just to see how is work and what response it gives.

     

    Just to clear better....my job is to find the first table in the gerarchy and so follow the relations to find the tables linked to each other....like a tree......

                         a                                 d

                   b         c                      e           f

         ...........       ............           .........     .........

         The master are a and in this case.....but in a database What are the tools that permit to find the a and b are the first tables in the tree dependencies?

     

     

    Thank

  • sorry....

    I wontedto write...........

    The master tables are:

     a and d in this case.....

    but in a database What are the tools that permit to find that a and d are the first tables in the tree dependencies?

     

  • If you want to see the relations between tables, you can use a free tool called dbvisualizer, from minq software .

    They have a good graphical way of representing the referential integrity, and you can choose to see all tables, or specified tables only, or only tables that have referential links.

    You can download from http://www.dbvis.com

    However, if in your database, there are a lot of tables having a lot of referential links, the schema will be difficult to read....

    Gael

Viewing 6 posts - 1 through 5 (of 5 total)

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