on-internet
← Community

Teradata Sub-string Before and After certain character

Stack Overflow ·

I am looking for a way to extract text that is before and after a certain character in Teradata. For example, I have a column that is consistent except for the word in the middle - which I want to extract. I have these two examples: "Customer Activated Account DD: ABCD, ON DATE XXXX" "Customer Activated Account DD: EFGH, ON DATE XXXX" I need the text that exists right after ":" and before "," - in this case ABCD or EFGH. So far I have SUBSTRING (column FROM POSITION ('DD: ' IN column) +4) but that returns everything after the ":" like ABCD, ON DATE XXXX.

Comments

Sign in or sign up to comment and upvote.

No comments yet.