约束GUI如何在SQL Server Management Studio中运行?

时间:2022-01-13 09:35:34

In my TSQL table I added a constraint with the following sQL statement

在我的TSQL表中,我添加了一个带有以下sQL语句的约束

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..

我是手工完成的,因为我无法弄清楚GUI应该如何工作。您添加一个约束,然后您将获得一个窗口,您应该“定义”您的约束。它基本上只是一个文本框。无论我似乎进入什么,它永远不会验证..

What am I supposed to enter in the box?

我应该在盒子里输入什么?

2 个解决方案

#1


11  

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

在新的索引窗口中检查唯一

#2


1  

Example, column must be between 0 and 1,

例如,列必须介于0和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.

添加唯一约束时,它实际上是一个索引,如主键,因此您单击索引/键。

#1


11  

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

在新的索引窗口中检查唯一

#2


1  

Example, column must be between 0 and 1,

例如,列必须介于0和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.

添加唯一约束时,它实际上是一个索引,如主键,因此您单击索引/键。