Home > Net >  How to separate two strings separated by a ; into two columns
How to separate two strings separated by a ; into two columns

Time:12-01

So for example I have this

Fullname
Elen;Morales
Sasha;Karl Wickens

and I want to have this

Firstname      Lastname
Elen           Morales
Sasha         Karl Wickens

Is it possible to do it with regexp_replace?

CodePudding user response:

You can use split_part():

select split_part(fullname, ';', 1) as firstname,
       split_part(fullname, ';', 2) as lastname
from the_table;
  • Related