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

Delete last character ina column

Status
Not open for further replies.

dom24

Programmer
Aug 5, 2004
218
GB
Hi,

I have a column named FName and some of the data has a space at the end of the name.
I need to delete the space (the last character) from each Fname.
I have the query to select the fnamces that have a space at the end:

SELECT FName from Staff where FName = '* '

But now I need to UPDATE all the results and remove the space. I've got RIGHT(FName, Len(FName)-1) which will remove the last character, but i'm not sure how to loop from each FName and then UPDATE it.

Thanks.
 
dom24,

Something like

UPDATE Staff SET Staff.FName = RTrim([FName])
WHERE Staff.FName = "*";

Mordja
 
One shot brute force method:
UPDATE Staff SET FName=Trim(FName);

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