在SQL Azure Federation中创建具有主键和单独的唯一列的表 [英] Create a table with a primary key and a separate unique column in SQL Azure Federation

查看:55
本文介绍了在SQL Azure Federation中创建具有主键和单独的唯一列的表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在SQL Azure Federation中创建一个uniqueidentifier ID列和一个唯一的nvarchar(256)电子邮件地址列?我不是SQL专家,所以我不知道如何设置唯一约束,或者是否有可能在联合数据库中进行设置.

How could I create a uniqueidentifier ID column and a unique nvarchar(256) email address column in SQL Azure Federation? I'm not a SQL guy, so I don't know how to set a unique constraint or if it's possible to do that in a federated database.

我找到了一个创建唯一约束的TSQL查询,但出现以下错误:

I found a TSQL query to create a unique constraint, but I'm getting the following error:

联合表上的唯一索引或聚集索引必须包含联合列"

"A unique or clustered index on a federated table must contain the federated column"

我认为我的联合列是ID列.

I think my federated column is the ID column.

推荐答案

只要按照错误告诉您的内容进行操作即可.

just follow what the error tells you.

联合列必须是唯一索引或聚集索引的一部分.

federated columns are required to be part of a unique or clustered index.

请参阅:联盟准则和局限性

因此,对于您的唯一索引,列应为Id + emailAddress

so, for your unique index, the columns should be Id+emailAddress

这篇关于在SQL Azure Federation中创建具有主键和单独的唯一列的表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆