create table #t(txt varchar(100))
insert into #t select 'xyz10oo'
insert into #t select 'a10yyz'
insert into #t select 'ab10i'
select left(txt,charindex('10',txt)-1)
from #tdrop table #t
insert into #t select 'xyz10oo'
insert into #t select 'a10yyz'
insert into #t select 'ab10i'
select left(txt,charindex('10',txt)-1)
from #tdrop table #t
select @str='a10yyz',@substr='10'
select substring(@str,1,charindex(@substr,@str)-1)