简体   繁体   English

模式不同时,将数据从一个数据库导入到另一个数据库

[英]importing data from one database to other when schemas are different

I have this SQL Server 2005 DB and we are upgrading to a new DB in SQL Server 2008. The schemas would be slightly different between the databases. 我有此SQL Server 2005数据库,并且我们正在升级到SQL Server 2008中的新数据库。数据库之间的架构会稍有不同。 What would be a best option to copy data from the old DB to the new DB. 将数据从旧数据库复制到新数据库的最佳选择是什么。

Define "slightly different". 定义“稍有不同”。 Integration Service is probably the way to go. 集成服务可能是解决之道。

Since the schemas are only slightly different, I would suggest making a full backup of the SQL2005 DB and restoring it on the SQL2008 server. 由于架构仅稍有不同,我建议对SQL2005 DB进行完整备份,然后将其还原到SQL2008服务器上。 Once you have the direct copy, use a script to migrate the data on the few tables where the schema is different. 获得直接副本后,请使用脚本在架构不同的几个表上迁移数据。

It really depends on the definition of slightly. 这确实取决于稍微的定义。

Use Integration Service to design a whole package, or you can connect to the 2005 instance from within 2008 SSMS and right click on the tables and select "Import Data". 使用Integration Service设计整个程序包,或者您可以从2008 SSMS内连接到2005实例,然后右键单击表并选择“导入数据”。 This will bring up an Wizard that will do the work for you (through SSIS) and let you copy the data right over. 这将打开一个向导,它将通过SSIS为您完成工作,并让您直接复制数据。

Another option is to use SQL Server Data Tools, which is a new tool from MS that has a schema compare tool where you can actually generate the scripts to create the tables and related objects. 另一个选择是使用SQL Server数据工具,它是MS的一种新工具,具有架构比较工具,您可以在其中实际生成用于创建表和相关对象的脚本。

http://msdn.microsoft.com/en-us/data/gg427686 http://msdn.microsoft.com/en-us/data/gg427686

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM