Drop Primary keys

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jamesd0142
    Contributor
    • Sep 2007
    • 471

    Drop Primary keys

    [code=sql]
    select 'ALTER TABLE ' + primary_table + ' drop CONSTRAINT '
    + primary_key_nam e + ' FOREIGN KEY (' + foreign_column_ 1 + ')'
    from sysfkeys order by foreign_table
    [/code]

    How can I change this code to allow me to drop all primary keys instead of foriegn keys?

    Is there an equivelant table for the primary keys as this one "sysfkeys " for the forign keys?

    James
  • ck9663
    Recognized Expert Specialist
    • Jun 2007
    • 2878

    #2
    Check this out

    -- CK

    Comment

    Working...