IF EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[order_153_103_nextpage]') AND type = 'P')
DROP PROCEDURE [dbo].[order_153_103_nextpage]
GO

-- 生成时间:2018-06-27 14:12:35 by ebs-core  
CREATE  procedure order_153_103_nextpage(
@objids varchar(8000)
) 
as  
begin  
set nocount on 
  declare @t table(objid bigint) 
  declare @i int, @curInd int, @strlen int, @s1 varchar(100) 
  set @curInd = 1 
  set @strlen = LEN(@objids) 
  set @s1 = '' 
  while (@curInd <= @strlen) 
  begin 
    set @i = charindex(',', @objids, @curInd) 
    if (@i>0) 
    begin 
      set @s1 = SUBSTRING(@objids, @curInd, @i - @curInd) 
      set @curInd = @i + 1 
    end 
    else if (@curInd <= @strlen) 
    begin 
      select @s1 = SUBSTRING(@objids, @curInd, @strlen - @curInd + 1) 
      set @curInd = @strlen + 1 
    end 
    if (@s1>'') 
    begin 
      insert into @t(objid) values(convert(bigint, @s1)) 
    end 
  end 
  select a.* from order_153_103 a, @t 
  where ord2_id = objid  
  order by ord2_order,ord2_code,ord2_id 
set nocount off
end