Create a table with a primary key and a separate unique column in SQL Azure Federation

六眼飞鱼酱① 提交于 2019-12-11 18:07:11

问题


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.

Edit:

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"

I think my federated column is the ID column.


回答1:


just follow what the error tells you.

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

see: Federation Guidelines and Limitations

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



来源:https://stackoverflow.com/questions/12416925/create-a-table-with-a-primary-key-and-a-separate-unique-column-in-sql-azure-fede

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!