add ANOTHER primary key to a table which is UNIQUE
Posted
by
gdubs
on Stack Overflow
See other posts from Stack Overflow
or by gdubs
Published on 2011-03-09T16:00:07Z
Indexed on
2011/03/09
16:10 UTC
Read the original article
Hit count: 326
so im having problems with adding another primary key to my table. i have 3 columns: 1. Account ID (Identity) 2. EmailID 3. Data field
when i made the table i had this to make the Account ID and the Email ID unique
PRIMARY KEY (AccountID, EmailID)
i thought that would make my emailid unique, but then after i tried inserting another row with the same emailid it went through. so i thought i missed something out.
now for my question:
- IF, i had to use alter, How do i alter the table/PK Constraint to modify the EmailID field and make it Unique
- IF i decided to drop the table and made a new one, how do i make those two primary keys uniqe?
Thanks a bunch!!
© Stack Overflow or respective owner