简体   繁体   English

如何在具有不同表结构的数据库之间复制数据?

[英]How to copy data between databases which has different table structures?

I came to know how to copy data from one database to another database within one server, from this Transfer data from one database to another database and between different servers from this Copy table to a different database on a different SQL Server , but I want to copy data of table from one database to another database which has different table structures. 我开始知道如何将数据从一个数据库复制到一台服务器内的另一个数据库,从该数据库中将数据从一个数据库转移到另一个数据库,以及在不同服务器之间从此复制表复制到不同SQL Server上的另一个数据库 ,但是我想将表的数据从一个数据库复制到另一个具有不同表结构的数据库。

I will explain my requirements with an example. 我将通过一个示例解释我的要求。

Consider a table contains basic information of patients such as FirstName, LastName, Gender, Contact, Address, OpShortNotice, HasDiabetes, HasBloodPressure and so on. 考虑一个包含患者的基本信息的表,例如名字,姓氏,性别,联系人,地址,OpShortNotice,HasDiabetes,HasBloodPressure等。

In source database it has table named Patient and contain all the above fields, where as in my destination database has FirstName, LastName, Gender, Contact, Address fields in the table named Person and OpShortNotice, HasDiabetes, HasBloodPressure fields in the table named Patient . 源数据库中,该表具有名为Patient的表,并且包含上述所有字段,在我的目标数据库该表具有名为Person的表中的FirstName,LastName,Gender,Contact,Address字段,而在名为Patient的表中具有OpShortNotice,HasDiabetes,HasBloodPressure字段。 Then how to copy data from source to destination database? 然后如何将数据从源复制到目标数据库?

Like above simple example scenario, I have many tables and massive data to be migrated. 像上面的简单示例场景一样,我有许多表和大量数据要迁移。 As of now, my source and destination are in same server to make a trail of Data migration but definitely my future requirement will be with different servers. 到目前为止,我的源和目标位于同一台服务器中,可以进行数据迁移,但是绝对可以,我未来的需求将是使用不同的服务器。

Please, Anyone help me to do this with scripts or any particular tool meeting my requirements. 拜托,任何人都可以帮助我使用满足我要求的脚本或任何特定工具来做到这一点。

Thank you, in advance. 先感谢您。

SQL Server integration services is designed specifically to do this. SQL Server集成服务是专门为此目的而设计的。

it is primarily used for data warehousing where data is taken from one (or mulitple ) database and stored in another, differently designed database. 它主要用于数据仓库,其中数据从一个(或多个)数据库中获取并存储在另一个设计不同的数据库中。

in the case of data warehousing the second database is normally designed for better data retrieval and reporting access and less concerned with normalisation. 在数据仓库的情况下,通常将第二个数据库设计用于更好的数据检索和报告访问,而不必担心标准化。

often this process will use an intermediary to allow for multi stage transformation 通常,此过程将使用中介程序进行多阶段转换

this process is often called ETL (Extract transform and Load) 此过程通常称为ETL(提取转换和加载)

In this case, you probably need to set up an intermediary ("translation") database which contains data structures from both sides plus a software which loads the data from the source, transforms it and then saves it in a staging area where you can check the results of the transformation process. 在这种情况下,您可能需要建立一个中间数据库(“翻译”),该数据库包含双方的数据结构,以及一个从源中加载数据,对其进行转换然后将其保存在暂存区域中的软件,您可以在其中进行检查转换过程的结果。

If the output looks good, you can load it in the target system. 如果输出看起来不错,则可以将其加载到目标系统中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在两个不同服务器中的数据库之间主动同步数据? - How to actively sync data between databases which are in 2 different servers? 如何在同一台服务器上的两个 Azure 数据库之间将一个表数据复制到另一个表中 - How to copy one table data to another one between two Azure databases on the same server 在 SQL 数据库之间复制数据 - Copy Data between SQL Databases 如何使用 Sql Server 2008 比较不同数据库中两个表之间的数据? - How to compare data between two table in different databases using Sql Server 2008? SQL Azure - 在数据库之间复制表 - SQL Azure - copy table between databases 将数据从在 SQL 中具有相同表的两个不同数据库复制到临时表 - Copy data to temporary table from two different databases having same table in SQL 仅在两个数据库之间复制数据 - Copy data only between two databases 如何将数据从一个表复制到另一个具有新列的表? - How do I copy over data from one table to another which has new columns? 如何在两个不同的数据库之间同步某些数据字段 - How to synchronize some data fields between two different databases 在没有PK的情况下在不同数据库中的表之间复制数据(例如,同步) - Copy data between tables in different databases without PK's ( like synchronizing )
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM