0

I understand that tenantid needs to be in all tables that you want to federate on in SQL Azure federations. But do you really need to change the foreign key constraint itself to have tenantid + actualPrimaryKey? Or can you just keep the actualPrimaryKey as the only field in the actual foreign key constraint?

I read that "In addition to that, any table that contains a foreign key constraint, which references a federated table, will also need TenantId added and also become a federated table. For example, imagine if we had an Orders table, which we decided to make a federated table" on this blog post.

Benny Hill
  • 6,191
  • 4
  • 39
  • 59
DkDev
  • 547
  • 5
  • 14

1 Answers1

0

As far as I know, yes, you have to.

  1. In federated table, the federation column must be the primary key, or part of the primary key. i.e. if we have OrderID as the primary key and if we need federated this table by TenantID, the new primary key must be OrderID + TenantID

  2. If we have OrderDetail table related with Order, the foreign key to OrderID must be changed to OrderID + TenantID as well, since we need OrderID + TenantID to identify the record in Order table.

Shaun Xu
  • 4,476
  • 2
  • 27
  • 41
  • To complete the answer, source here : http://msdn.microsoft.com/en-us/library/windowsazure/hh597469.aspx (check via CRTL+F on "foreign"). – JYL May 04 '13 at 14:29