Solved

How to update data in a certain range of id?

Posted on 2009-05-04
2
252 Views
Last Modified: 2012-05-06
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
Comment
Question by:techques
2 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 25 total points
ID: 24295667
update yourtable
  set id = id + 5000
where id between 1 and 10001
0
 
LVL 19

Assisted Solution

by:LordOfPorts
LordOfPorts earned 25 total points
ID: 24295686

UPDATE table_name

SET column_name = value

WHERE id >= 5001

AND id <= 5500

Open in new window

0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

When writing XML code a very difficult part is when we like to remove all the elements or attributes from the XML that have no data. I would like to share a set of recursive MSSQL stored procedures that I have made to remove those elements from …
INTRODUCTION: While tying your database objects into builds and your enterprise source control system takes a third-party product (like Visual Studio Database Edition or Red-Gate's SQL Source Control), you can achieve some protection using a sing…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now