zoukankan      html  css  js  c++  java
  • 存储过程拆分字符窜

    ALTER PROCEDURE [dbo].[P_ComparePrice]
     @siteName varchar(50),
     @goodsId varchar(max)
    AS
    BEGIN
      DECLARE @splitChar CHAR(1)
      DECLARE @IDS VARCHAR(20)
      SET @splitChar = ','
     
      WHILE(charindex(@SplitChar,@goodsId)<>0)----当分隔符的索引不等于0时 
      BEGIN  
         SET @IDS=SUBSTRING(@goodsId,1,charindex(@splitChar,@goodsId)-1)----取值
        -- print @IDS
       EXEC [P_DeleteRepeatRecord] @siteName,@IDS ----调用存储过程
         SET @goodsId=STUFF(@goodsId,1,charindex(@SplitChar,@goodsId),'')----设置分割后的字符串
      END
     

    END

  • 相关阅读:
    ZOJ 3556
    ZOJ 2836
    HDU 2841
    HDU 4135
    POJ 3695
    POJ 2773
    HDU 4407
    HDU 1796
    ZOJ 3688
    ZOJ 3687
  • 原文地址:https://www.cnblogs.com/qq4004229/p/2377200.html
Copyright © 2011-2022 走看看