query to display all dependent objects of a table

  • hi all,

    i wanna to see all dependent objects of a table

    such as tables(with foreign key references),views,sp,udf,triggers

    regards

    Durgesh J

  • Very easy: right click on the table and click View Dependencies and you will see all other objects related to that table!

    You can see the results in attachment!

    😎

    ============================================================
    SELECT YOUR PROBLEM FROM SSC.com WHERE PROBLEM DESCRIPTION =
    http://www.sqlservercentral.com/articles/Best+Practices/61537/[/url]

  • And if you want to use T-SQL command then use sql_dependencies

    SELECTTOP 10 * From sys.sql_dependencies

    WHERE [OBJECT_ID]= OBJECT_ID(N'ObjectName')

  • sysdepends is not always accurate. check out this topic.

    http://qa.sqlservercentral.com/Forums/Topic571247-338-1.aspx. Although this relates to SQL 2005 it applies to SQL 2000 as well.

    "Keep Trying"

  • Yea this is true!

    I cannot see any results from Hari's T-SQL, everything is empty! 😛

    ============================================================
    SELECT YOUR PROBLEM FROM SSC.com WHERE PROBLEM DESCRIPTION =
    http://www.sqlservercentral.com/articles/Best+Practices/61537/[/url]

  • Dugi (1/30/2009)


    Yea this is true!

    I cannot see any results from Hari's T-SQL, everything is empty! 😛

    Keep Smiling...

    Anyway, This should work:

    EXEC sp_depends @objname = N'TableName'

  • Hari.Sharma (1/30/2009)

    Keep Smiling...

    Anyway, This should work:

    EXEC sp_depends @objname = N'TableName'

    Now is Ok! :w00t: thnx for the sp info!

    ============================================================
    SELECT YOUR PROBLEM FROM SSC.com WHERE PROBLEM DESCRIPTION =
    http://www.sqlservercentral.com/articles/Best+Practices/61537/[/url]

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

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