开发者

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开发者_如何学Python

best regards


Depending on how complex your needs are, you may want to look into using 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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜