Toad World® Forums

Attribute: Creating unique attribute / Alternative Key causes errors.


#1

Scenario:

I want to add a new Attribute to an existing Entity. The new Attribute will have unique values. I am using SQL Server 2012.

Expect:

The new Attribute with a new Key named AK_AttributeName, and a unique non-clustered index.

Actual

I create a new Attribute and select “Unique (New AK)”. A new Key is created called PK_AttributeName. The Attribute Key is clustered.

First the new attribute shouldn’t be prefixed with “PK”. Second, it should not be a clustered index; SQL Server defaults the Primary Key as a clustered index. I also will get an error because I cannot have two clustered indexes.

Thanks. Jake.


#2

Hello Jake,

when you create a new attribute “Unique (New AK)”, a new key is created on tab Keys and by default it has the same name as the attribute. You can edit the key - rename it and change the Clustered property.

You write the key is prefixed “PK”… It seems you defined the key names this way. Maybe you use naming convention for keys…?

Regards,

Vladka