One column is nullable on the composite key
From: Andy (net__space_at_hotmail.com)
Date: 08/13/04
- Next message: Adam Machanic: "Re: Output parameter question (again - hehe)"
- Previous message: Hugo Kornelis: "Re: Resticting No of entries"
- Next in thread: Adam Machanic: "Re: One column is nullable on the composite key"
- Reply: Adam Machanic: "Re: One column is nullable on the composite key"
- Reply: Anith Sen: "Re: One column is nullable on the composite key"
- Reply: Steve Kass: "Re: One column is nullable on the composite key"
- Reply: --CELKO--: "Re: One column is nullable on the composite key"
- Reply: Erland Sommarskog: "Re: One column is nullable on the composite key"
- Messages sorted by: [ date ] [ thread ]
Date: 13 Aug 2004 06:32:06 -0700
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
- Next message: Adam Machanic: "Re: Output parameter question (again - hehe)"
- Previous message: Hugo Kornelis: "Re: Resticting No of entries"
- Next in thread: Adam Machanic: "Re: One column is nullable on the composite key"
- Reply: Adam Machanic: "Re: One column is nullable on the composite key"
- Reply: Anith Sen: "Re: One column is nullable on the composite key"
- Reply: Steve Kass: "Re: One column is nullable on the composite key"
- Reply: --CELKO--: "Re: One column is nullable on the composite key"
- Reply: Erland Sommarskog: "Re: One column is nullable on the composite key"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|