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

Separating data within a field (ie. Johnson,Emily)

Status
Not open for further replies.

roisinmck

Technical User
May 11, 2006
4
US
I'm using foxpro/sql

I have a name field but unfortunatley is has both the first and last name within the same field. As noted above 'Johnson,Emily'

How do I parse out the name into different fields?

 
This should work (tested with PSQL v9.1):
Code:
select left(FieldName,locate(',',FieldName)-1),right(rtrim(FieldName),(length(f1) - locate(',',FieldName))) from TABLE

Mirtheil
Certified Pervasive Developer
Certified Pervasive Technician
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top