sql - Take substring out of string -


this question has answer here:

i have key string like

empl:9998 earn code:7704 seq:1 

i need take employee number 9998 out of string.
employee number start @ position 6 , end before second e.
have been played around string function no success. use ms sql.

the following statement this:

select substring(empno, 6,                  charindex('e', empno, 6) - 6) (select 'empl:9998 earn code:7704 seq:1' empno) t; 

you might want -7 if don't want space in "number".


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -