Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does the constraints GUI work in SQL Server Management Studio?

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?

like image 706
Boris Callens Avatar asked Jun 18 '09 14:06

Boris Callens


2 Answers

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

like image 150
SQLMenace Avatar answered Nov 11 '22 18:11

SQLMenace


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.

like image 32
marr75 Avatar answered Nov 11 '22 19:11

marr75