| Author |
Primary key problem
|
Alvin chew
Ranch Hand
Joined: Jan 08, 2004
Posts: 834
|
|
hi, i using code to add new primary key(cam_name) to table which already have existing primary key (cam_code), but somehow it give me ""Multiple primary key defined " error i using following code to query should i drop the existing primary key then only add both primary key together ? like following i found it tredious to do that, is there any better solution ? thank you very much for answering ! for another case, let say the table contains 3 primary key, and i want to drop only one of the primary key, what should i do ? [ December 05, 2004: Message edited by: Alvin chew ]
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26216
|
|
Alvin, Are you trying to add a column to the existing primary key or a new key entirely? A table can only have one primary key. You can add a unique constraint to any other column(s) though. If you are trying to add a column to an existing primary key, some databases do not let you do this without dropping the table.
|
[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
|
 |
Alvin chew
Ranch Hand
Joined: Jan 08, 2004
Posts: 834
|
|
|
Thanks,Jeanne Boyarsky
|
 |
Adeel Ansari
Ranch Hand
Joined: Aug 15, 2004
Posts: 2874
|
|
Originally posted by Jeanne Boyarsky: If you are trying to add a column to an existing primary key, some databases do not let you do this without dropping the table.
Its 'without dropping the table' or 'without dropping the key'. If 'table' then you must be talking about MS ACCESS.
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26216
|
|
Adeel, That is correct. I was trying to keep my comments non-database specific.
|
 |
 |
|
|
subject: Primary key problem
|
|
|