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

Teradat 13.10. Need to split the string with a delimiter.

Status
Not open for further replies.

micjohnson382

Programmer
Dec 1, 2017
1
0
0
US
This is in continuation of the forum thread328-1421546

select 'ABC.DEF.GHI.JKL.MNO' as MYCOLUMN
,substring(MYCOLUMN from 1 for (position('.' in MYCOLUMN) (named POSDOT1)) - 1) as FIELD1
,substring((substring(MYCOLUMN from POSDOT1 + 1) (named SUB1)) from 1 for (position('.' in SUB1) (named POSDOT2)) - 1) as FIELD2
,substring((substring(SUB1 from POSDOT2 + 1) (named SUB2)) from 1 for (position('.' in SUB2) (named POSDOT3)) - 1) as FIELD3

The above query return first 3 values.
FIELD1 --> ABC
FIELD2 --> DEF
FIELD3 --> GHI

I want to return JKL and MNO also as FIELD4 and FIELD5. I am very new to Teradata and I have tried lot but could not succeeded. Appreciated your help.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top