如何复制具有不同结构但相同字段的两个表? [英] How to replicate two tables with different structures but the same fields?

查看:145
本文介绍了如何复制具有不同结构但相同字段的两个表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在不同位置有两个SQL Server数据库,我想做类似复制的事情. 这是我的情况: 在第一个数据库中,我有一个具有以下结构的表:

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

如您所见,我在两个不同数据库中的表结构是不同的. 但我只想复制State and city字段. 如果必须更改在第一个数据库中更改的第一个数据库中的state and city,反之亦然. 我该怎么做?我可以复制吗?

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?

推荐答案

定义文章时,必须将@vertical_partition参数设置为true,然后使用sp_articlecolumn添加所需的列.

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.

这篇关于如何复制具有不同结构但相同字段的两个表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆