Results 1 to 4 of 4

Thread: Primary Keys

  1. #1
    Join Date
    Oct 2003
    Posts
    20

    Unanswered: Primary Keys

    Hi everyone,
    Does someone knows how can I drop a primary key (that I don't know the name) from a table in one sql statement.

    Thanks,
    Fady

  2. #2
    Join Date
    Feb 2004
    Location
    Poland
    Posts
    96
    Enterprise Manager ?

  3. #3
    Join Date
    Oct 2003
    Posts
    20
    I know I can use enterprise manager and I know that I can get the name of the primary key from sysobjects in a query but I need to know if I can in one sql statement (using alter table .... drop constraint as example) drop the primary key for a certain table.

  4. #4
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    One of the odder requests seen on this forum.

    To do it as a single statement you would need to EXECUTE an SQL String that you construct on the fly from the schema tables.

    And I can't believe there would be a good reason for doing this.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

Posting Permissions

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