procedure循环插入数据.

declare @clause_ID varchar(1000)
declare @i int
set @Clause_Id='111111111111111,2222222222222222222222,'
set @i=charindex(',',@Clause_Id)
    while @i>=1
    begin  
       -- Insert   Cls_Contract_Selected_Clauses_For_New_Template_Info (SelectedClauses_Id,NewTemplate_Id,Order_Num)
 -- Values(left(@Clause_Id,@i-1),@newTemplateId,@orderNum+1)
print(left(@Clause_Id,@i-1))
        set @Clause_Id=substring(@Clause_Id,@i+1,len(@Clause_Id)-@i)
        set @i=charindex(',',@Clause_Id)
    end

你可能感兴趣的:(procedure)