How to replicate two tables with different structu

2019-08-27 03:32发布

问题:

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.