zoukankan      html  css  js  c++  java
  • SQL分割字符串函数


    --SQL分割字符串函数的调用查询语句

    --输出结果为数据表

    Declare @strPrimaryKey nvarchar(500)
    set @strPrimaryKey='1,2,3,4,5,6,7'
    Declare @strPlitChar nvarchar(10)
    set @strPlitChar=','
    Declare @strReturn nvarchar(500)

    select * from  dbo.fun_SplitStr(@strPrimaryKey,@strPlitChar)

    --SQL分割字符串函数
    CREATE FUNCTION dbo.fun_get_SplitStr
    (
     @SourceSql    varchar(8000),
     @StrSeprate    varchar(100))
     returns @temp   table(F1 varchar(100)
    )  
    AS    
    BEGIN  
      declare ch   as    varchar(100)  
      set     @SourceSql =@SourceSql+@StrSeprate    
      while(@SourceSql<>'')  
      BEGIN
            set      @ch=left(@SourceSql,charindex(',',@SourceSql,1)-1)  
       insert   @temp   values(@ch)  
       set      @SourceSql=stuff(@SourceSql,1,charindex(',',@SourceSql,1),'')  
      END  
      return  
    END

  • 相关阅读:
    jQuery-选择器及属性修改
    jQuery 基础理论
    CSS 之 BFC(块级格式化上下文)
    H5--Web Storage
    H5 -WebWorker
    H5 --拖放
    nodejs Multer中间件
    k8s pod
    kubernetes
    优化CUDA数据传输
  • 原文地址:https://www.cnblogs.com/xqf222/p/3306839.html
Copyright © 2011-2022 走看看