declare @L varchar(20), @R varchar(20), @Len int, @FromNo int, @F1 intselect @L='19011', @R='', @Len=3, @FromNo=1Select F1,F2from (Select F1=(Row_number() over (order by Fno))+isnull(@FromNo,0)-1, F2=convert(int,SUBSTRING(Fno,len(@L)+1,@Len)) From qu