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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:46:25+00:00 2026-05-23T22:46:25+00:00

Working environment is SQL Server 2000. I have a table with no indexes, no

  • 0

Working environment is SQL Server 2000. I have a table with no indexes, no PK… Total number of rows is 600,000.

How can I update a column from row 0 -> 100,000 with a value then from 100,001 -> 200,000 with another, and so on?

Thank you.

  • 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-23T22:46:26+00:00Added an answer on May 23, 2026 at 10:46 pm

    set all values to null, then SET ROWCOUNT 100000. Then do successive updates ( each will affect 100000 rows) with different values where that column IS NULL. @@rowcount will be the number of rows affected after each update, so stop when it is less than 100000.

    For @Shannon’s comment, the ROWCOUNT will not be honored for update/delete/insert statements in the next version of SQL Server (post-SQL Server 2008), but it will work fine for SQL Server 2000. The recommended change is to use the TOP clause, but I don’t think that is supported for updates until SQL Server 2005.

    I think you could sue a cursor if you wanted…

    update mytable set myid = null
    
    SET NOCOUNT ON -- prevent all those "1 row(s) updated" messages
    declare @count int, @value int, @myid int
    set @count = 1
    set @value = 1
    declare cursor_update cursor for select myid from mytable
    open cursor_update
    fetch cursor_update into @myid
    while @@FETCH_STATUS = 0
    begin
        update mytable set myid = @value where current of cursor_update
    
        set @count = @count + 1
        if (@count > 100000) 
        begin
            set @count = 1
            set @value = @value + 1
        end
    
        fetch cursor_update into @myid
    end
    close cursor_update
    deallocate cursor_update
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have recently migrated some 30 DTS packages in SQL Server 2000 to SSIS
All - I have recently upgraded our production environment from Sql Server Reporting Services
Environment I'm working on a C++ application that uses SQL Native Client 9.0 to
I am working in the Linux environment, and I have a C++ program, what
I have a relatively simple site that I'm working up for an intranet environment.
I'm using MS Query Analyzer (as part of SQL Server 2000) to write T-SQL
I have a view defined in SQL server 2008 that joins 4 tables together.
I have a script that appends some rows to a table. One of the
I have a SQL Server 2008 database (call it productionDB) that contains data and
With the help of answers on SO, I have created a SQL Server UDF

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.