0
NOIDEHOB_NOIDE1_4321-123

i want to create a querie that extract the following values from the example above:

NOIDEHOB
NOIDE1
4321-123

I need to base the query on the sign _. The values NOIDEHOB, NOIDE1 and 4321-123 are dynamic and the length will vary. There will never be any other _ sign in the string.

Any suggestions?

stianzz
  • 49
  • 1
  • 6

1 Answers1

1

You can use string_split():

select s.value
from string_split('NOIDEHOB_NOIDE1_4321-123', '_') s
Gordon Linoff
  • 1,242,037
  • 58
  • 646
  • 786