简体   繁体   中英

The Best Way For Transfer Data From One DataBase (sql server 2008) To Another db(sql server 2008) With Different Schema

what is the best way For Transfer Data From One DataBase (sql server 2008) To Another db(sql server 2008) With Different Schema?

is there a program for doing that ?

thanks 4 your future asnwer

best regards

根据您的需求复杂程度,您可能需要考虑使用SSIS

I would use SSIS (which comes with sql server) to do this. This will not be an easy or quick task however. Mapping from one schema to another can be very time consuming and you will almost certainly find data that doesn't fit from one schema to the other that you have to deal with. For example if the field is varchar in the first schema and datetime in the second, you will almost certainly have to exclude bad values (like "ASAP") which can be a problem especially if the field is a required field. In fact you will have to deal with those types of mismathces as well - if it wasn't required and now is, what value do you put in there for the records where it currently is null . What do you do when field sizes don't match up, you may have to truncate data. If you have different lookup values from one to the other, you need a conversion table. You may need a conversion table to relate old and new id fields so that you can properly load child tables. This is a very complex task.

Link the source server to the dest server. Then you can, from the dest server, executes your very own queries such as

INSERT INTO Destination_Table (col1, col2, col3)
    SELECT colA, colB, colC
    FROM [SRC_MACHINE\SRC_SERVER].Source_Database.dbo.Source_Table

If you're comfortable with writing queries, you can include all your data transformation (if you need any) in the nested SELECT, and play with JOINs and stuff to make the selected data structure fit the destination schema.

Doable even if both servers are running SQL Server Express (which is not shipped with SSIS). Documentation on Linking Servers

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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