Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 Remove last character after last space in a string

Author  Topic 

vignesht50
Yak Posting Veteran

82 Posts

Posted - 2014-09-22 : 07:19:03
Hi All,

I'm having string values like mentioned below.

String Values:

George, Matt J

Rambla, Tony G.

Expected Output:

George, Matt

Rambla, Tony

I would need to trim the letters like mentioned above. Can anyone help me with this?

I achieved the same in SQL by below query

declare @String as varchar(20) = 'Rambla, Tony G.'
select left(@string,len(@string)+1-charindex(' ',reverse(@string)))

How can I achieve this in MS Access?

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2014-09-22 : 08:08:46
Something like:

SELECT LEFT(a, INSTRREV(a, " "))

Harsh Athalye
http://www.letsgeek.net/
Go to Top of Page

vignesht50
Yak Posting Veteran

82 Posts

Posted - 2014-09-22 : 09:06:18
quote:
Originally posted by harsh_athalye

Something like:

SELECT LEFT(a, INSTRREV(a, " "))

Harsh Athalye
http://www.letsgeek.net/



I am not able to trim the characters like I mentioned.
Go to Top of Page
   

- Advertisement -