Bulk Copy from one server to another

Posted by Joseph on Stack Overflow See other posts from Stack Overflow or by Joseph
Published on 2010-04-07T11:15:22Z Indexed on 2010/04/07 11:23 UTC
Read the original article Hit count: 588

Filed under:
|
|
|

Hi All, I've one situation where I need to copy part of the data from one server to another. The table schema are exactly same. I need to move partial data from the source, which may or may not be available in the destination table. The solution I'm thinking is, use bcp to export data to a text(or .dat) file and then take that file to the destination as both are not accessible at the same time (Different network), then import the data to the destination. There are some conditions I need to satisfy. 1. I need to export only a list of data from the table, not whole. My client is going to give me IDs which needs to be moved from source to destination. I've around 3000 records in the master table, and same in the child tables too. What I expect is, only 300 records to be moved. 2. If the record exists in the destination, the client is going to instruct as whether to ignore or overwrite case to case. 90% of the time, we need to ignore the records without overwriting, but log the records in a log file.

Please help me with the best approach. I thought of using BCP with query option to filter the data, but while importing, how do I bypass inserting the existing records? If I need to overwrite, how to do it?

Thanks a lot in advance. ~Joseph

© Stack Overflow or respective owner

Related posts about bcp

Related posts about bulk