我试图根据条件添加约束条件。 例子:根据条件使用T-SQL添加约束条件
CREATE TABLE dbo.TestTable(
[DbKey] [uniqueidentifier] NOT NULL,
[GroupKey] [uniqueidentifier] NOT NULL,
[EnableGroup] bit NOT NULL
CONSTRAINT [TestTable_PK] PRIMARY KEY CLUSTERED
(
[DbKey] ASC
)
)ON [PRIMARY]
因此,有可能是将具有相同GroupKey多条记录,但我想顶多一个记录,能有EnableGroup设置为true对于一个给定GroupKey。
任何帮助表示赞赏。
[T-SQL唯一约束可能重复WHERE AnotherColumn = ParticularValue](http://stackoverflow.com/questions/4097484/t-sql-unique-constraint-where-anothercolumn-particularvalue) – 2011-02-25 11:36:27
刚刚意识到我链接到的问题是另一个我试图关闭并列出2其他重复... – 2011-02-25 11:49:46