Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2003
    Posts
    233

    Unanswered: Select details of Primary key for list of tbls

    I have a list of tables using :
    EXEC sp_depends @objname = @Column


    results
    tbl1
    tbl2
    tbl3
    tbl4
    ....

    I inserted them into a temp table and would like to find the primary key for each table (they may be multicolumn keys) I have no idea how to do this.

    Thanks for the help!

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    query the INFORMATION_SCHEMA views
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Dec 2008
    Posts
    135
    see this
    select name,object_name(parent_object_id) from sys.objects where type = 'pk'

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •