Is it possible to create a restriction to prevent different ones Col2 on the same Col1where the first column cannot be NULLunlike the second?
To clarify my requirement, look at the example data with a single line:
MaterialNumber(varchar50, not null) fiModel(int, null, fk)
1234-4321 1
Can a second line be prevented with the same MaterialNumberbut different fiModel?
Here is the sql script, the second one INSERTshould fail, as this is a different model with the same number.
In the case of a rot connection:
Table (simplified):
CREATE TABLE [dbo].[tabSparePartMasterData](
[MaterialNumber] [varchar](50) NOT NULL,
[fiModel] [int] NULL)
Two lines, the second insertion may not be possible:
INSERT INTO tabSparePartMasterData(MaterialNumber,fiModel)
VALUES('1234-4321', 1);
INSERT INTO tabSparePartMasterData(MaterialNumber,fiModel)
VALUES('1234-4321', 2);
, fiModel NULL, null, fiModel. MaterialNumber + fiModel ( null) . , fiModel.