SQL Server Performance

Which related foreign table is used?

Discussion in 'Getting Started' started by tarekj, Sep 10, 2008.

  1. tarekj Member

    Hi,
    When I try to delete some records from the primary table it says that it has related records in other tables, my questin is :
    - Is there a way to tell which foreign table has records related to the primary table?
    Thanks
    Tarek Al-Jamal
  2. Madhivanan Moderator

    [quote user="tarekj"]
    Hi,
    When I try to delete some records from the primary table it says that it has related records in other tables, my questin is :
    - Is there a way to tell which foreign table has records related to the primary table?
    Thanks
    Tarek Al-Jamal
    [/quote]1
    EXEC sp_help 'primary table'
    2 EXEC sp_fkeys 'primary table'
  3. tarekj Member

    By this way I have to check these tables one by one to check if they have records or not, I want to know which one has the related records so I can go directly and delete them.
    Thanks
  4. ghemant Moderator

    Hi,
    You can check running sp_depends 'tblename' to check the dependancy!!

Share This Page