declare @L varchar(20),
@R varchar(20),
@Len int,
@FromNo int,
@F1 int
select @L='19011',
@R='',
@Len=3,
@FromNo=1
Select F1,F2
from (Select F1=(Row_number() over (order by Fno))+isnull(@FromNo,0)-1,
F2=convert(int,SUBSTRING(Fno,len(@L)+1,@Len))
From quoteCtrl
Where Fno like @L+'[0-9][0-9][0-9]'+@R
and isnumeric(SUBSTRING(Fno,len(@L)+1,@Len))=1
and convert(int,SUBSTRING(Fno,len(@L)+1,@Len))>=@FromNo
) A
where F1<>F2
order by f1 asc