Query Help.

  • Follow


I need to delete the last character in a field. Can somone help with a query 
or SQL statement please? 

0
Reply Kissi 2/11/2011 3:03:20 AM

Kissi Asiedu wrote:
> I need to delete the last character in a field. Can somone help with a 
> query or SQL statement please?

Let's say you had a table called Emps and a field called LastName, 1 
record, and had a value of Smith.  You could create a column called 
Minus1Char to return Smit to see how that works.

In the query builder enter
   Minus1Char : Left([LastName],Len(LastName)-1)

Len returns the length of a string.  Subtract 1 from that value.  Now 
get the n number of chars starting from the beginning of the string to 
the length value using the function Left()

To update the value of the field LastName in table Emps you'd use an 
update query.
  UPDATE Emps SET LastName = Left([LastName],Len([LastName])-1);
0
Reply Salad 2/11/2011 3:40:28 AM


1 Replies
197 Views

(page loaded in 0.523 seconds)


Reply: