I have a string column where I need to find the substring until the first '-' is found.
Example column ELOT-IGS-2. I need to get "2" as output. These columns come from a table so I cannot declare the variable as a fixed string.
I tried LOCATE
, SUBSTRING_INDEX
but none are build in functions.
I also tried RIGHT(ID_BETSLIP,CHARINDEX('-',ID_BETSLIP)-1)
but this does not work when I have 2 times "-"
Does anyone have an idea?