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 185677
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T15:30:45+00:00 2026-05-11T15:30:45+00:00

I have a csv file with 350,000 rows, each row has about 150 columns.

  • 0

I have a csv file with 350,000 rows, each row has about 150 columns.

What would be the best way to insert these rows into SQL Server using ADO.Net?

The way I’ve usually done it is to create the SQL statement manually. I was wondering if there is any way I can code it to simply insert the entire datatable into SQL Server? Or some short-cut like this.

By the way I already tried doing this with SSIS, but there are a few data clean-up issues which I can handle with C# but not so easily with SSIS. The data started as XML, but I changed it to CSV for simplicity.

  • 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. 2026-05-11T15:30:46+00:00Added an answer on May 11, 2026 at 3:30 pm

    Make a class ‘CsvDataReader’ that implements IDataReader. Just implement Read(), GetValue(int i), Dispose() and the constructor : you can leave the rest throwing NotImplementedException if you want, because SqlBulkCopy won’t call them. Use read to handle the read of each line and GetValue to read the i’th value in the line.

    Then pass it to the SqlBulkCopy with the appropriate column mappings you want.

    I get about 30000 records/per sec insert speed with that method.

    If you have control of the source file format, make it tab delimited as it’s easier to parse than CSV.

    Edit : http://www.codeproject.com/KB/database/CsvReader.aspx – tx Mark Gravell.

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

Sidebar

Related Questions

I have a CSV file that holds about 200,000 - 300,000 records. Most of
I have a CSV data file with rows that may have lots of columns
I have .csv file with 4 columns. What's the easiest way to remove a
I have a csv file that has 2 columns separated by a comma -
I have a .csv file that is frequently updated (about 20 to 30 times
I have an application that reads a CSV file with piles of data rows.
I have CSV file which has timestamp in the first column as shown below
I have csv file with 14 columns and I want to sort it in
I have a csv file that has column values enclosed within double quotes. I
I have a csv file into which has crept some ^M dos line ends,

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.