Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. How to find foreign key for a given table in sql server 2005

How to find foreign key for a given table in sql server 2005

Scheduled Pinned Locked Moved Database
sharepointdatabasesql-serversysadminhelp
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    NK7
    wrote on last edited by
    #1

    Hi How to find foreign key for a given table in sql server 2005. exec sp_fkeys @pktable_name='authors' //It is working fine in sql 2000 But the same is not working for 2005. exec sp_fkeys @pktable_name='[Production].[Product]' also I tried exec sp_fkeys @pktable_name='[Test].[Production].[Product]' Can any one help me please kesavan

    P 1 Reply Last reply
    0
    • N NK7

      Hi How to find foreign key for a given table in sql server 2005. exec sp_fkeys @pktable_name='authors' //It is working fine in sql 2000 But the same is not working for 2005. exec sp_fkeys @pktable_name='[Production].[Product]' also I tried exec sp_fkeys @pktable_name='[Test].[Production].[Product]' Can any one help me please kesavan

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #2

      Try this:

      sp_fkeys @PKTable_name = N'Product', @PKTable_owner = N'Sales'
      

      (This, of course, assumes that you have a product table in a Sales schema).

      Deja View - the feeling that you've seen this post before.

      N 1 Reply Last reply
      0
      • P Pete OHanlon

        Try this:

        sp_fkeys @PKTable_name = N'Product', @PKTable_owner = N'Sales'
        

        (This, of course, assumes that you have a product table in a Sales schema).

        Deja View - the feeling that you've seen this post before.

        N Offline
        N Offline
        NK7
        wrote on last edited by
        #3

        Thanks a lot pete kesavan

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups