• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 302
  • Last Modified:

How to update data in a certain range of id?

Hi

There are over 10000 records in a table with id from 1-10001.

However, I just want to update a field's value from id=5001 to 5500

How should I write that query in MSSQL 2005?

0
techques
Asked:
techques
2 Solutions
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
update yourtable
  set id = id + 5000
where id between 1 and 10001
0
 
LordOfPortsCommented:

UPDATE table_name
SET column_name = value
WHERE id >= 5001
AND id <= 5500

Open in new window

0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now