sql - Take substring out of string -
this question has answer here:
- how substring of string in sql 2 answers
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
Post a Comment