简体   繁体   中英

Insert data from a server to another server No linked sql server 2008

I need to copy data using sqlserver 2008

Server1.database.dbo.table to

Server2.database.dbo.table

Servers are not linked and cannot link them. Cannot use SSIS or any other BI stuff I dont know how to use it,not time to learn.

My approach

Scripted all the data "sql server wizard " "Create Data=true" and then run the script.

my challenge

  1. Some columns might not exists in Server2.database.dbo.table A table

  2. some tables might have the same Primary keys and foreign keys as destination table so Ignore

what is the best approach? Any free tools I can use where I can map columns?

At the moment I am going for a manual script where I have generated the Insert and I have manually worked out the dependency order and commented out the columns that have the same primary keys as destination table.

Wondering if there is a better way?

Any suggestions? Many thanks

This may be a controversial suggestion, but consider using MS Access as an intermediary.

Access will let you link both tables, and write a query to copy from one to the other. It certainly won't be fast, and you may have timeout issues you'll have to address, but you'll get your automatic column-mapping, and if you have MS Office then you'll already have it.

I'm NOT suggesting you download all your data to your PC, but I am suggesting that you try linking both tables into an Access database and copying data from one to the other.

If your target database doesn't have the target tables (though it sounds like it does) you'd have to create them via scripting first, but Access does an adequate job copying data from place to place. I call it "the poor man's SSIS".

It has the advantage that once you've written the queries you need, and perhaps a macro to execute them in order, you can save them, and re-execute them, or tweak them, without having to manipulate a script.

SSIS would still be the best solution for your problem , but if you don't have it available or haven't time to learn to use it, I'd look into Access.

最后,我最终写的脚本比学习ssis更快,因为它是一次性的。

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