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?

techquesAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Guy Hengel [angelIII / a3]Connect With a Mentor Billing EngineerCommented:
update yourtable
  set id = id + 5000
where id between 1 and 10001
0
 
LordOfPortsConnect With a Mentor Commented:

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

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.