Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Split a column into two

Hi Team,

I have a table containing three fields STUDENT, TYPE and MARKS.

I need to split Column TYPE in to two columns i.e.. SUBJECT and  EX_TYPE

SUBJECT column will contain PAPER-I, PAPER-II, PAPER-III and so on.

EX_TYPE column will contain INTERNAL, EXTERNAL, PRACTICAL etc.

Can any one help me out of this problem.

Regards

Priyanka

1 Solution

Accepted Solutions
patroser
Partner - Creator
Partner - Creator

should like something like this in load script:

LOAD

     Student,

     Marks,

     Subfield(Type, ' ', 1) as Subject,

     Subfield(Type, ' ', 2) as Ex_Type

FROM ...

Best regards,

Patrick

View solution in original post

4 Replies
patroser
Partner - Creator
Partner - Creator

should like something like this in load script:

LOAD

     Student,

     Marks,

     Subfield(Type, ' ', 1) as Subject,

     Subfield(Type, ' ', 2) as Ex_Type

FROM ...

Best regards,

Patrick

Anonymous
Not applicable
Author

You can use a subfield function in your script if the two columns are going to be separated by space.

subfield(Type,' ',1) as SUBJECT,

subfield(Type,' ',2) as EX_TYPE

prieper
Master II
Master II

Suggest to use SUBFIELD with three params:

SUBFIELD(Type, ' ', 1)     AS Subject,

SUBFIELD(Type, ' ', 2)     AS ExType

edit: messages crossed - sorry, apostroph removed

HTH Peter

Not applicable
Author

Thanks a lot Patrick