Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update

Status
Not open for further replies.

WJProctor

Programmer
Jun 20, 2003
151
GB
Hi there, i have a list of rows in a database that all have a field in called deleted, this is set to 0 is the field is not delete and 1 if it is deleted. The point is that i would like to convert lets say 3 of the deleted rows to undeleted, how would i go about this.

Hope someone can help

JP

James Proctor

 
You have to have a way to identify the specific rows you want to change.

Let's say you have a field called myid and it's unique for each row and let's say the myid for the three rows are 1,20, and 57.

UPDATE mytable
SET deleted = 0
WHERE myid IN ('1', '20', '57')

Or doing one at a time:

UPDATE mytable
SET deleted = 0
WHERE myid = '1'

then change the myid # to 20, then 57.

If the myid is an integer you don't need the single quotes.

-SQLBill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top