Link to home
Start Free TrialLog in
Avatar of PattiN
PattiN

asked on

SQL Substring Extraction

I need to use SQL to extract first name and last name from a table that stores name as follows:

last_name, first_name mi

ex: 'Doe, Jane L'
      'Smith Jr., Frank C'
      'Brown M.D., Lawrence'

Thanks!
Avatar of wilcoxon
wilcoxon
Flag of United States of America image

select last_name&', '&first_name&' '&mi from table

Open in new window

If that doesn't work, replace all of the & with || - I can't remember which is the correct syntax in Sybase.
Avatar of PattiN
PattiN

ASKER

I wasn't clear, sorry.  I mean that I need to extract first name as one field and last name as another field from a column in a table that stores the whole name as 'last name, first name mi'.  So, in my example above, I need the following results:

from:  'Doe, Jane L'
         'Smith Jr., Frank C'
         'Brown M.D., Lawrence'

I need two columns in my SQL result set:
First Name             Last Name
Jane                         Doe
Frank                       Smith Jr.
Lawrence                Brown M.D.
ASKER CERTIFIED SOLUTION
Avatar of TommySzalapski
TommySzalapski
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of PattiN

ASKER

That's great, thank you!