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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T07:31:18+00:00 2026-06-11T07:31:18+00:00

I have to update every row in a Sql Server table with about 150,000

  • 0

I have to update every row in a Sql Server table with about 150,000 records using entity framework. To reduce the amount of hits the server takes, I would like to do this in separate batches of 1000 rows. I need entity framework to:

  1. Select the first 1000 rows from the DB.
  2. Update those rows.
  3. Call SaveChanges() method.
  4. Get next 1000 rows.
  5. Repeat.

Whats the best way to achieve this?

I’m using entity framework 4 and SQL Server 2012.

  • 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-06-11T07:31:19+00:00Added an answer on June 11, 2026 at 7:31 am

    something like this should work:

    int skip =0;
    int take = 1000;
    for (int i = 0; i < 150; i++)
    {
    var rows = (from x in Context.Table
                select x).OrderBy(x => x.id).Skip(skip).Take(take).ToList();
    
    //do some update stuff with rows
    
    skip += 1000;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table in a SQL Server 2008 database. I need to update
I have a single table in the Sql Server 2008 r2 DB. Every few
I have a Translation table and I want every update to it to automatically
I want to have an 'updateinfo' table in order to record every update/insert/delete operations
I have a table that someone update this table every day. I would like
I have an sql table containing the gps coordinates of a device, updated every
I have a SQL Server table full of orders that my program needs to
I have an update statement in SQL server where there are four possible values
(Note: this is for MS SQL Server) Say you have a table ABC with
I have the follow T-SQL to update a table with test data: UPDATE SomeTable

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.