I have a column which has values or rows as combination of name & Code as seen below.
Data_Current
Column_X
---------------------------
Saint_Peter_King_Jr_0001
Kishore_Prasad_Misra_1253
George_Floyd_21543
Veer_Venkata_Sai_Narsimha_Kishore_00015
and I want to get Name & Code in different column but the separator '_' and its occurrence(Count & Position) is not same in every row or value as seen above.
So how to read the string from the right and extract the name & Code as below
Result Required
Name Code
---------------------------------------------
Saint_Peter_King_Jr 0001
Kishore_Prasad_Misra 1253
George_Floyd 21543
Veer_Venkata_Sai_Narsimha_Kishore 00015
I tried but instr function but INSTR( string, substring [, start_position [, th_appearance ] ] ) but the appearance is not constant and changes based on name. How to make it dynamic?