May 30, 2006 at 6:22 am
Does anyone know how or if I can combine a check constraint with unique constraint? For example tbla has 3 columns, col1, col2, col3. col1 and col2 must be unique if col3 is a certain value.
June 5, 2006 at 4:32 pm
Sounds to me like you might need to control that particular scenario programmatically.
From my understanding, you usually define uniqueness via an index but I don't believe they are conditional.
As for looking at it from the other end, i.e. creating a check constraint, I don't think you can access the whole table to see if a certain value exists - unless you can use a user defined function to confirm the existence of the the required value. Can't say I've tried it but it might be worth a look.
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy