Home Multiple primary key constraints?
Reply: 0

Multiple primary key constraints?

user626
1#
user626 Published in June 22, 2018, 11:33 am

I have a table like this:

CREATE TABLE BACAEN
(
CAEN_KEY INT PRIMARY NOT NULL,
CAET_KEY INT,
BUUN_KEY INT
)

I've already defined primary key on CAEN_KEY column. What I also need is to have unique records for CAET_KEY and BUUN_KEY together. (So, combination with same CAET_KEY / BUUN_KEY is allowed only once). The easiest way would be to generate one more composite primary key, but this is not possible because sql server doesn't allow multiple primary key constraints. What are alternatives to this?

Please note: I can not drop primary key constraint on CAEN_KEY.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.329439 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO