Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3697442
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T04:51:38+00:00 2026-05-19T04:51:38+00:00

I have two SQL servers: MyServer and TheirServer . I do not have the

  • 0

I have two SQL servers: MyServer and TheirServer. I do not have the option of linking these two servers.

I would like to get all of the data from a table on TheirServer and copy it into MyServer on a daily basis. The current number of records in the table is over 600k and will slowly increase. The tables are identical to each other, column names and data types.

My initial thought was to try and fill a datatable with a Select * query against TheirServer, and then try a SQLBulkCopy into MyServer. Naturally, this causes a System.OutOfMemoryException on the web server. Using that train of thought, my next plan of attack is to use a SQLDataReader to pull around 50k records at a time, then pause reading and BulkCopy those records, rinse and repeat. Before I did that, I thought I would see if I’m going about this the wrong way.

Note: Since I’m just asking for a best practice, I don’t mind if the code is in C# or VB, or if there is code at all.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T04:51:38+00:00Added an answer on May 19, 2026 at 4:51 am

    The command line (shell) is your friend. Checkout the bcp utility.

    Usage for your scenario is pretty simple:

    bcp src-database.dbo.src-table out "c:\work\datafile.dat" -S srcSQLServerInstance -E -n
    bcp tgt-database.dbo.tgt-table int "c:\work\datafile.dat" -S tgtSQLServerInstance -E -n
    

    You’ll need to truncate the destination (target) table prior to loading in the new data drop.

    This can all be done in a *.cmd batch file and scheduled.

    Alternatively, you can write an SSIS or DTS package to accomplish the same thing and schedule it within SQL Server.

    Myself, I like having a script than can easily be debugged/tested.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have set up transactional replication between two SQL Servers on different ends of
I have two SQL scripts which get called within a loop that accept a
I have two SQL Server 2005 databases, one is for development and the other
I have two named instances of SQL Server 2008 and am trying to set
I am using SQL Server 2000 and I have two databases that both replicate
I have two issues both related to (I believe) my SQL Server setup. I
I'm using LINQ to SQL and C#. I have two LINQ classes: User and
I'm wondering if this is possible in SQL. Say you have two tables A
I have a SQL query (MS Access) and I need to add two columns,
I've got two PostgreSQL databases that have been created using the same sql file.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.