Quantcast
Channel: Teradata Forums - Database
Viewing all articles
Browse latest Browse all 14773

I want to separate the full name in two parts - response (6) by 2aravinth

$
0
0

select name,firstname,lastname from (
select position('' in name)-1 pos, name,
length(name)-pos rem,
case when pos>0 then
substring(name,1,pos)
else name end as firstname,
case when pos>0 then
substring(name,pos+1,rem)
else null end as lastname
from name_table) x

 My coulmn "name" contains value like
Scenario 1:
"Jeeva Sussendran". My query will split it like "Jeeva" as FIRST NAME & "Suseendran" as LASTNAME.
 Scenario 2:
"George". Then it will be splited as "Manikandan" as FIRST NAME & will populate NULL for the LAST NAME.
 
If u need any further more clarifications revert me back.
 
Regards,
Manikandan A
 


Viewing all articles
Browse latest Browse all 14773

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>