• sql 语句


    declare @strtrannote nvarchar(100);
    declare @strlocation nvarchar(100);
    declare @tempstr nvarchar(100);
    set @strtrannote='a*b*'set @strlocation='1*2*';
    set @tempstr=@strlocation
    DECLARE @Index int;
    DECLARE @Left nvarchar(50);
    WHILE CHARINDEX('*',@strtrannote> 0--返回字符串中指定表达式的起始位置
     BEGIN
      
    SELECT @Index = CHARINDEX('*',@strtrannote);--返回字符串中第一个"&"的起始位置
      SELECT @Left = LEFT(@strtrannote,@Index-1);--从左边开始,取得字符串左边指定个数的字符(第一个值)
      --update TranNote set packlist_id=@packlist_id where TranNotekey=@LEFT and website=@website;
        DECLARE @Index2 int;
        
    DECLARE @Left2 nvarchar(50);
      
    set @strlocation=@tempstr
        
    WHILE CHARINDEX('*',@strlocation> 0--返回字符串中指定表达式的起始位置
            BEGIN
                
    SELECT @Index2 = CHARINDEX('*',@strlocation);--返回字符串中第一个"&"的起始位置
                SELECT @Left2 = LEFT(@strlocation,@Index2-1);--从左边开始,取得字符串左边指定个数的字符(第一个值)
                    print(@left);
                    
    print(@left2);
                
    SELECT @strlocation = REPLACE(@strlocation,@Left2+'*','');--将左边已经取出的部分替换为空
            END
      
    SELECT @strtrannote = REPLACE(@strtrannote,@Left+'*','');--将左边已经取出的部分替换为空

     END

    显示结果:

    a
    1
    a
    2
    b
    1
    b
    2

  • 相关阅读:
    Python网络爬虫之图片懒加载技术、selenium和PhantomJS
    验证码处理
    Python网络爬虫之三种数据解析方式
    Python网络爬虫之requests模块
    Python网络爬虫http和https协议
    Python网络爬虫相关基础概念
    jupyter环境安装
    AUTOTRACE Statistics常用列解释
    oracle 权限管理
    streams 日差管理及监控
  • 原文地址:https://www.cnblogs.com/lfzwenzhu/p/1332905.html
Copyright © 2020-2023  润新知