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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:33:47+00:00 2026-05-24T22:33:47+00:00

I have to update 5 million+ records in a Database for a table T1.

  • 0

I have to update 5 million+ records in a Database for a table T1. This is a C# tool which will READ (Select) a column in the table T1, say, T1.col1, then extract a value based on a logic from that column and finally have to UPDATE another column T1.col2 in the same table with this processed value and update the Db.

Wanted some opinions on the best/optimised way to achieve this in C# / ADO.NET ?

NOTE: The extraction logic cannot be part of SQL. That logic is
embedded in a COM DLL which I am interoping from .NET and applying on
the column Col1’s value to generate a new value which has to be finally saved in T1.Col2.

  • 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-24T22:33:48+00:00Added an answer on May 24, 2026 at 10:33 pm

    Since you need to transfer tha data for some operation by a COM object this is what I would do:

    Use a machine with lots of memory – Load the data in chunks (for example 5000 or 50000 rows at a time) into memory, process it and do the update on the SQL Server…

    For the UPDATE part use transactions and put 5000 – 20000 UPDATEs into one transaction…

    [EDIT]: by partitioning the work properly and assigning for 500000 or 1000000 rows to one “worker-machine” you can speed this up to the max limit of your SQL Server… [/EDIT]

    Another option – though not recommended (only because of theoretically possible security and/or stability issues introduced by the COM object in this specific case):

    Though this is a desciption regarding SQL Server something similar is possible with Oracle on Windows too

    You can put the logic of this transformation into your SQL Server by writing+installing a .NET assembly which exposes a Stored Procedure you can call to do the transformation… the .NET assembly in turn access that COM object… for a howto see http://www.sqlteam.com/article/writing-clr-stored-procedures-in-charp-introduction-to-charp-part-1

    The MSDN reference link to this is http://msdn.microsoft.com/en-us/library/ms131094.aspx

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

Sidebar

Related Questions

I have a dictionary in my database which has over million records and this
I have an extremely large database table - nearly 20 million records. The records
I have a table of about a million rows and I need to update
I have half a million records in a data set of which 50,000 are
I have a MySQL table for which I do very frequent SELECT x, y,
I have a table with just over 1 million records. Initially, my table is
I have a fairly huge database with a master table with a single column
I have an InnoDB table that lists customer orders - this table records the
I have a queryset with a few million records. I need to update a
I have a table that has about 1/2 million records in it. Each month

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.