Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2003
    Posts
    7

    Unanswered: drop primary key

    Hi,

    I added a primary keys and foreign keys to my tables using:

    alter table employee add primary key (ssn);
    alter table project add primary key (pnumber);
    alter table works_on add foreign key (essn) references employee(ssn);
    alter table works_on add foreign key (pno) references project(pnumber);


    And now I want to drop all the primary keys and foreign keys. I started first by trying to drop the foreign keys by using:

    alter table works_on drop constraint pno; -- which doesn't work

    I think im using the wrong syntax and it won't let me drop it. What is the correct syntax to drop the foreign keys and then the primary keys?


    Thanks ahead of time.
    Last edited by nickbn; 10-30-03 at 16:02.

  2. #2
    Join Date
    Oct 2003
    Posts
    7

    nevermind

    I found the problem. I wasn't defining any names for the primary keys and foreign keys so the system assigned them. I then found the names from the constraints_name field of the user_constraints dictionary.

Posting Permissions

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