# Cannot delete key

**URL:** <https://forums.toadworld.com/t/cannot-delete-key/2213>\
**Category:** Toad Data Modeler\
**Created:** [February 9, 2010, 2:32pm UTC](https://forums.toadworld.com/t/cannot-delete-key/2213 "2010-02-09T14:32:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cpisz\_515](https://avatars.discourse-cdn.com/v4/letter/c/3d9bf3/32.png) [@cpisz\_515](https://forums.toadworld.com/u/cpisz_515)\
**Post date:** [February 9, 2010, 2:32pm UTC](https://forums.toadworld.com/t/cannot-delete-key/2213/1 "2010-02-09T14:32:28Z")

</div>

I double click on an entity  
I click the “keys” tab

I have two entries:  
PK\_CLIENTS PK\_CLIENTS CLIENT\_ID o  
CLIENT\_ID CLIENT\_ID CLIENT\_ID o

The first has the red key marking it as the primary key  
The second has nothing under PK.

I don’t know how the second got there, perhaps a left over from changing my mind as to what atttribute would be the key? How do I delete the second? The delete button is greyed out.

When the script is generated it produces:  
– Add keys for table CLIENTS

ALTER TABLE “CLIENTS” ADD CONSTRAINT “PK\_CLIENTS” PRIMARY KEY (“CLIENT\_ID”)  
/

ALTER TABLE “CLIENTS” ADD CONSTRAINT “CLIENT\_ID” UNIQUE (“CLIENT\_ID”)  
/

Which gives an error.

Message was edited by: cpisz\_515

---

<div class="post-metadata">

**Author:** ![vladka](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/vladka/32/41_2.png) [@vladka](https://forums.toadworld.com/u/vladka)\
**Post date:** [February 10, 2010, 2:08am UTC](https://forums.toadworld.com/t/cannot-delete-key/2213/2 "2010-02-10T02:08:38Z")

</div>

Hi,

If I understand well, you have two keys on tab Keys. Both of them have the same attribute CLIENT\_ID.  
What might have happened: You added the attribute to PK (red key) and at the same time you set the attribute as Unique. Once you set an attribute as unique in TDM, an alternate key is created automatically. However, there’s no use setting a PK unique as a PK simply is unique.  
So, solution: Edit the attribute and clear the Unique checkbox for the attribute. The second key (alternate key) will be automatically removed.

Regards,

Vladka
