TERADATA - Finding the position of a substring in a string
We have Data : "Rj 0001 201410212014110301G 20141103ioR4564534 N20141021N 11R"
We want to extract : "R4564534" from the string.
We basically want to extract 8 characters after "R", ignore the first occurence "Rj"
Solution:
SUBSTR(columnX,INSTR(columnX,'R',2),8)
There's already an 'R' in the first position of your string, so we are starting the scan from position 2
nVector
posted on 22 Aug 18Enjoy great content like this and a lot more !
Signup for a free account to write a post / comment / upvote posts. Its simple and takes less than 5 seconds
Post Comment