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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:27:10+00:00 2026-05-30T17:27:10+00:00

Say i’m dealing with 10 library cards, each card has customer values (eg. member

  • 0

Say i’m dealing with 10 library cards, each card has customer values (eg. member number, member name …) and I need to update a value for each card.

If i want to grab all ten from the database but only want to update each row one at a time, is there an alternative to a cursor? I know a while loop might work but how would I be able to grab one row every time it loops until I am done with all 10 cards?

  • 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-30T17:27:11+00:00Added an answer on May 30, 2026 at 5:27 pm

    Don’t need to use cursors. I use this most of the time:

    declare @uid int -- this is the type unique index on the table you're updating
    
    -- Copy out the unique ids of the rows you want to update to a temporary table
    select uid into #temp from customers -- you can use a where condition here
    
    -- Loop through the rows of the temp table
    while exists (select 1 from #temp)
    begin
      set rowcount 1
      select @uid = uid from #temp -- pull one uid from the temp table
      set rowcount 0
      delete from #temp where uid = @uid -- delete that uid from the temp table
    
      -- Do something with the uid you have
      update customers set name = 'Joe Shmoe' where uid = @uid
    
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say, the field of Race in my table has values like W,A (white and
Say I have 10 million Customer names each associated with one or more Addresses
Say I have the following code: private Integer number; private final Object numberLock =
Say my web app has two spring cron jobs scheduled to run every minute/hour.
Say I have multiple objects laying on each other, if I click on one
Say I need to retrieve 20 thumbnail images from Azure BLOB after a button
Say that I have a table with two rows, and a cell in each.
Say I have an array of thousands of objects, and a small number of
Say I have a function pointer in C- library int (*fptr)(void); And I have
Say I have an ASMX web service, MyService. The service has a method, MyMethod.

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.