Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2004

    Unanswered: add / drop primary key

    hi, good day, i have a question on primary key , currently, i have a table call "newcampaign" which already contain a primary key, named "cam_code", now let say i want to add another primary key"cam_name" to existing "newcampaign" table ,

    so i using
    alter table newcampaign add PRIMARY KEY (cam_name);");
    but it give me error , say multiple primary key defined

    so i need to drop all primary key before add both of primary key (cam_name,cam_code)?

    another question is , if the table consist of 3 primary key, now i want to drop only one of the primary key , what should i do ? thank you very much !!

  2. #2
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    you can only have one primary key per table, as far as I'm aware. However you can create other keys which have unique values.

    If you want to set another key as primary key then youwillneed todelete the old index first, and the add the new index

    You may find it easier to do this through soemthing like MySQL admin, dbtools or PHPAdmin

Posting Permissions

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