how to make foreign key relationship on physically

2019-08-01 04:04发布

问题:

  • three servers
  • server 1 is central point which links the other two servers.
  • the other two servers have a table which has a field which should act like a foreign key

problem

well i do not know how to do this, using vs08 or sql server 08

diagram view

table on server 1

sv1pg1 id -- primary key details

tables same schema on srvr2 and srvr3

linkedSRVid -- pk linkedto -- fk constrain should be between (server 1 primary key and this field)

note that

"this is just a simplest! way i can think of to represent the prob, the real dbs contain

many fields and tables and the following applies"

  • it's not always that the network connection between the server remains up.

  • the link only need for "writing purpose" not viewing, as viewing done by direct

connection to the respective server.

回答1:

A foreign key constraint can reference other tables only within the same database. This means that even if those databases were on the same server it still would not work.

Considering that the schemas are the same, you may want to look into replication.