How to replicate two tables with different structures but the same fields?

倖福魔咒の 提交于 2019-12-24 23:38:04

问题


I have two SQL server databases in different locations.I want to do something like replication. this is my scenario: In the first data base I have a table with following structure:

tbl_worker
_Name  nvarchar(10)
family nvarchar(20)
State  int
city   int

and in second data base I have following table:

tbl_employee
_Name   nvarchar(20)
family  nvarchar(15)
Address nvarchar(30)
Tell    nvarchar(14)
State   int
city    int

as you see the structure of my tables in two different data bases are not the same. but I want to replicate just State and city fields. if the state and city in the first data base changed in second data base must be changed and vice versa. How can I do it? Can I do it with replication and how?


回答1:


When you define the article, you'll have to set the @vertical_partition parameter to true and then add the columns that you want with sp_articlecolumn.



来源:https://stackoverflow.com/questions/5699783/how-to-replicate-two-tables-with-different-structures-but-the-same-fields

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