Create a table with a primary key and a separate u

2019-09-08 18:48发布

问题:

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