Which related foreign table is used?

Last post 09-11-2008 9:38 AM by ghemant. 3 replies.
Page 1 of 1 (4 items)
Active Topics My Discussions Unanswered Sort Posts: Previous Next
  • 09-10-2008 7:39 AM

    Which related foreign table is used?

    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

  • 09-10-2008 7:53 AM In reply to

    Re: Which related foreign table is used?

    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

    1 EXEC sp_help 'primary table'
    2 EXEC sp_fkeys 'primary table'

    Madhivanan

    Failing to plan is Planning to fail
  • 09-11-2008 4:09 AM In reply to

    Re: Which related foreign table is used?

    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

  • 09-11-2008 9:38 AM In reply to

    Re: Which related foreign table is used?

    Hi,

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

    Hemantgiri S. Goswami | MS SQL Server MVP
    -------------------------
    "Humans don't have Caliber to PASS TIME , Time it self Pass or Fail Humans" - by Hemantgiri S. Goswami

    http://hemantgirisgoswami.blogspot.com
    http://forums.surat-user-group.org/

    View Hemantgiri S. Goswami's profile on LinkedIn

    Disclaimer: This post is provided as is, for the sake of knowledge sharing only.
Page 1 of 1 (4 items)
Active Topics   My Discussions    Unanswered Posts


© 2000 - 2007 vDerivatives Limited All Rights Reserved.