Hi,
Is there a way to create a check constraint so that the value of a column will be unique depending on the value of another column?
More specifically, the value of column B can be different only if column A has a newer value.
Example,
Create table Ex (
[Id] INT NOT NULL IDENTITY,
[A] NVARCHAR(10) NOT NULL,
[Loc] NVARCHAR(10) NOT NULL,
[B] INT NOT NULL,
);
Id A Loc B
1 ABC 20 1
2 ABC 30 1
3 CDF 40 1
4 GHI 40 2
5 GHI 70 2
6 GHI 80 2
Thank you.