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

  • Home
  • SEARCH
  • 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 7652713
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T11:50:31+00:00 2026-05-31T11:50:31+00:00

I have a big table in SQL Server 2008 R2. It contains billions of

  • 0

I have a big table in SQL Server 2008 R2. It contains billions of rows. I need to load the whole data set in our application. Query the whole table is very slow. I want to use bcp dump it into a file and load it. But the problem is there are string columns it contains all kinds of special characters like ‘\t’, ‘\0’, comma, and ‘\n’. I can’t find a good field/row terminator. But long string terminator slows down the data file loading for my application. The question is:

  1. Is there any API that load data faster then SQL query? I find there is a native importing API IRowsetFastLoad. But not lucky on exporting.
  2. Is there any API for BCP native format? I can’t find any document about the format of native bcp file.
  • 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-31T11:50:33+00:00Added an answer on May 31, 2026 at 11:50 am

    From BOL:

    -n

    Performs the bulk copy operation using the native (database) data types of the data. This option does not prompt for each field; it uses the native values.

    Billions of rows? Then you will also want to use :

    -b batch_size

    Specifies the number of rows per batch of data copied. Each batch is copied to the server as one transaction. SQL Server commits or rolls back, in the case of failure, the transaction for every batch.

    Can’t you access the two databases at once, perhaps through Linked Server? It would make things easier.

    DECLARE @StartId BIGINT
    DECLARE @NmbrOfRecords BIGINT
    DECLARE @RowCount BIGINT
    
    SET @StartId = 0
    SET @NmbrOfRecords = 9999
    SET @RowCount = 1
    
    WHILE @RowCount > 0
    BEGIN
      BEGIN TRANSACTION
    
      INSERT INTO DestinationDatabase.dbo.Mytable
      SELECT * FROM SourceDatabase.dbo.Mytable
      WHERE ID BETWEEN @StartId AND @StartId + @NmbrOfRecords
    
      SET @RowCount = @@ROWCOUNT
    
      SET @StartId = @StartId + @NmbrOfRecords + 1
    
      COMMIT TRANSACTION
    END
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working with a big table (~100.000.000 rows) in SQL Server 2008. Frequently,
I have SQL Server 2008 Ent and OLTP database with two big tables. How
I need to create some pretty big tables in SQL Server 2008. While I
Im programming C# WinForm application which have big SQL Server Database. I need to
Our application (using a SQL Server 2008 R2 back-end) stores data about remote hardware
I have a big (4M records) table on a SQL Server with the following
I have a SQL Server 2005 database. I am logging data to a table.
I have this big data-entry sort of page, a table kind of layout using
I have the following situation: .net 3.5 WinForm client app accessing SQL Server 2008
I have one BIG table(90k rows, size cca 60mb) which holds info about free

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.