How does the constraints GUI work in SQL Server Management Studio?
-
06-07-2019 - |
Question
In my TSQL table I added a constraint with the following sQL statement
alter table disabledqualities
add constraint uc_uIdQualCode
unique (userId, qualitycode)
I did it by hand because I just can't work out how the GUI is supposed to work.
You add a constraint and then you get a window where you should "define" your constraint. It's basically just a textbox. And no matter what I seem to enter, it never validates..
What am I supposed to enter in the box?
Solution
you would use new index not new constraint to add a unique constraint (read index) new constraint is to add check constraints
in the new index window check unique
OTHER TIPS
Example, column must be between 0 and 1,
((0)<=[TABLE].[COLUMN] AND [TABLE].[COLUMN]<=(1))
When adding unique constraints, it's actually an index, like primary key, so you click on indexes/keys.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow