zoukankan      html  css  js  c++  java
  • sqlserver查找断号,回收单据号

    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

  • 相关阅读:
    第四次作业
    第三次
    第十次作业
    第九次作业
    第八次作业
    10.29第七次
    15
    14
    13 this
    12 电视机
  • 原文地址:https://www.cnblogs.com/zyb2016/p/11643093.html
Copyright © 2011-2022 走看看