Hi all, I need to put a constraint on a table. This constraint will help to pull out an error in our legacy software, as the legacy software is putting duplicate records in a table.
Fairly simple you might think. My problem is that on one of the fields I only want the constraint to fail if it’s a certain value for eg ‘A’ in the field. This is because I want to cause minimum disruption within the software. Here is my constraint
Assuming that field4 can be an A or a B then I would like it to fail only if it’s an A but not fail if it’s a B.
Is this even possible? If not what are my alternatives?
Thx in advance T
Age is a consequence of experience
Fairly simple you might think. My problem is that on one of the fields I only want the constraint to fail if it’s a certain value for eg ‘A’ in the field. This is because I want to cause minimum disruption within the software. Here is my constraint
Code:
ALTER TABLE MySmallTable
ADD CONSTRAINT UQ_MySmallTable UNIQUE (Feild1, Feild2, Feild3, Feild4)
Is this even possible? If not what are my alternatives?
Thx in advance T
Age is a consequence of experience