Hi All!
I would like to have a composite PK on 3 columns, one of them is null
CREATE TABLE TableA (
ColA int NOT NULL ,
ColB int NOT NULL ,
ColC char (3) NULL ,
......
)
GO
ALTER TABLE TableA ADD
CONSTRAINT TableA_PK PRIMARY KEY CLUSTERED
(
ColA,
ColB,
ColC
)
GO
SQL Server does not allow having a composite PK with one nullable column:
What is wrong to have values?
1,100,NULL
1,200,ABC
1,200,ABD
.....
Code in C applies to Values in B and for some values in B the code does not exist.
I can work out and define a special Code:
NEV(not existing value), but in general I do not understand this restriction.
Thanks