[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: substring



You can substring the part until a comma... if you are
sure that the format is always
lastname-comma-firstname.

e.g.

let $name = 'Lee, James G'
let $lastname = substr($name, 1, char_index(',',$name)
- 1) ! the position before the comma
let $first6 = substr($lastname, 1, 6)

Arjan


--- "Cadenas, Maria (MT)" <MCadenas@DOW.COM> wrote:
> we need to select the first six letters of a last
> name for each employee,
> however, the format for the field is:
> Last, First Middle (i.e. Lee, James G)
>
> Is there a way to make sure we substring only the
> first six letters of ONLY
> the last name? so that if the last name is three
> digits (i.e Lee) we ONLY
> get Lee and NOT Lee, J?
>
> Any advice is appreciated.


__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35
a year!  http://personal.mail.yahoo.com/