how to make foreign key relationship on physically distributed data?

南笙酒味 提交于 2019-12-11 12:18:29

问题


  • 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.



来源:https://stackoverflow.com/questions/3746410/how-to-make-foreign-key-relationship-on-physically-distributed-data

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