通用分页存储过程,源码共享,大家共同完善

2020-07-10 08:06:42易采站长站整理

        end
        set @j = charindex(‘.’, @tmp)
        if (@j>0)
            set @tmp = substring(@tmp, @j+1, len(@tmp))
        –*******当有字段有别名时,只保留字段别名*********
        –带括号的情况要单独处理,如Convert(varchar(10), B.EndDate, 120) as EndDate
        while (charindex(‘(‘, @tmp) > 0)
        begin
            set @iLeft = @iLeft + 1
            set @tmp = substring(@tmp, charindex(‘(‘, @tmp)+1, Len(@tmp))
        end
        while (charindex(‘)’, @tmp) > 0)
        begin
            set @iRight = @iRight + 1
            set @tmp = substring(@tmp, charindex(‘)’, @tmp)+1, Len(@tmp))
        end
        –当括号恰好组队的时候,才能进行字段别名的处理
        if (@iLeft = @iRight)
        begin
            set @iLeft = 0
            set @iRight = 0
            –不对这几个特殊字段作处理:CheckBox、DetailButton、Radio
            if (charindex(‘CheckBox’, @tmp) = 0 and charindex(‘DetailButton’, @tmp) = 0 and charindex(‘Radio’, @tmp) = 0)
            begin
                –判断是否有别名
                if (charindex(‘as’, @tmp) > 0)–别名的第一种写法,带’as’的格式
相关文章 大家在看