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

Change format name with comma 1

Status
Not open for further replies.

TheLazyPig

Programmer
Sep 26, 2019
95
PH
Hi!

How can I change Lastname;Firstname;mi to Lastname, Firstname mi?


Thanks in advance.
 
If you have this data in your table:
[tt]
table: People
Person
Brown; Jack; X
White; Susie; Q[/tt]

and you want to have:
[tt]
table: People
Person
Brown, Jack, X
White, Susie, Q[/tt]

You can simply do:[tt]
Update People Set Person = Replace(Person, ';', ',')[/tt]

Unless you want something completely different...[ponder]

---- Andy

"Hmm...they have the internet on computers now"--Homer Simpson
 
If you want the first semicolon changed to a comma and the rest changed to a blank, I think this will do it.
Full disclosure - not tested.
Code:
... substr(Person, 1, instr(person,';')- 1 )||', '||REPLACE(substr(person,instr(person,';')+1),';',' ') ...
 
The code was working. Maybe the problem is where I run it. I'm running it on foxpro v9 but the tables I used is from an oracle db.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top