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

Query Update to remove last 3 characters of a string

Status
Not open for further replies.

meagain

MIS
Joined
Nov 27, 2001
Messages
112
Location
CA
I'm looking for a formula to use in an update query which will remove the last 3 characters in a string of variable length.

Thank you!!
 

Take a look at Left() and Len() build-in functions
 
Update mytable set mystring = left(mystring,len(mysstring)-3);

using your tablename and column name of course

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Although I hate when I steel the joy from discovering new frontiers,
Code:
UPDATE yourTableName 
SET yourFieldName = Left([yourFieldName], Len([yourFieldName])-3)
WHERE Len([yourFieldName])> 3;

In case there are only 2 characters in the string of variable length.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top