declare @str varchar(100)set @str = '60cdkkkkklmmmn'print substring(@str,charindex('k',@str)+1,(len(@str)-charindex('m',reverse(@str))-charindex('k',@str)))