Posted Thu, 29 Aug 2013 15:30:00 GMT by Portal Admin

Is it possible to take a character based field from my iseries and split it based on a qualifier like a "space"?
For instance a single 15 character field will read WILL CAMPBELL, I need to have 2 fields in my view. One containing just the first name, another just the last name.. Possible??

Posted Thu, 16 Jun 2016 05:00:00 GMT by Portal Admin

Hi there~

Yes this is possible.

Easiest way is using the SPLIT function:

Here is an example you can plug into your SQL statement:

 

 SELECT       'Jackie Daugherty' NAME(myname), Split(myname, " ") NAME(first) LEN(15), Split(myname, " ", 2) NAME(last) LEN(25)
 FROM          sqlexec
 

Originally Posted By jdaugherty

You must be signed in to post in this forum.