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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mass update when data contains "-" 2

Status
Not open for further replies.

chris3942

Technical User
Jul 2, 2003
17
US
We have a table with a column labeled "Model". In many of the records the "Model" contains a "-" (ie: -345). I need to change every model that is proceeded with a dash to
that model followed with "-REPAIR". In other words if the record shows the data as "-345" I'd like to update it to show as "345-REPAIR". I need help handling the dashes in the Update Query.
 
Put this in the Update field:


Code:
IIf(Left(Trim([Model]),1)=Chr(45),Mid(Trim([Model]),2,Len([Model])-1) & Chr(45) & "Repair",[Model])


TomCologne
 
UPDATE yourTable SET Model=Trim(Mid([Model],2)) & "-REPAIR"
WHERE Model Like '-*';

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top