SQL 分割符“|”
来源:互联网 发布:mac os 10.9 百度云 编辑:程序博客网 时间:2024/05/07 11:47
/*
StringToTable
*/
CREATE FUNCTION StringToTable(@StringX varchar(8000),@Split nvarchar(10))
RETURNS @TableResult TABLE(TableID nvarchar(20))
AS
BEGIN
DECLARE @Index int
DECLARE @LenIndex int
SELECT @LenIndex=LEN(@Split),@Index=CHARINDEX(@Split,@StringX,1)
WHILE (@Index>=1)
BEGIN
INSERT INTO @TableResult SELECT LEFT(@StringX,@Index-1)
SELECT
@StringX=RIGHT(@StringX,LEN(@StringX)-@Index-@LenIndex+1),@Index=CHARINDEX(@Split,@Stri
ngX,1)
END
IF(@StringX<>'') INSERT INTO @TableResult SELECT @StringX
RETURN
END
字符串分割自定义函数
declare @s1 varchar(8000),@s2 varchar(8000)
set @s1='1,2,3,5'
set @s2='1,2,3,4,5,6'
set @s1=' select id=' + replace(@s1,',',' union all select ')
set @s2=' select id=' + replace(@s2,',',' union all select ')
set @s1=' select b.* from (' + @s1 + ') a right join (' + @s2 + ') b on a.id=b.id where a.id is null '
exec(@s1)
- SQL 分割符“|”
- sql 解释带分割符的字符串
- sql SQL分割字符串
- 分割字符串的sql
- SQL 字符串分割函数
- SQL分割字符串存储
- SQL分割字符串函数
- sql分割逗号
- 分割函数sql
- SQL分割字符串
- SQL分割字符串函数
- SQL 字串分割函数
- SQL分割字符串函数
- SQL分割字符串
- SQL Server字符串分割
- sql 分割字符串
- sql 分割字符串 输出
- sql 分割字符串
- JSP如何防范SQL注入攻击
- 位、字节、字及相关概念
- C画斜椭圆源程序
- JSP如何防范SQL注入攻击
- 简单方法搞定日期格式转换的问题
- SQL 分割符“|”
- ASP.NET页面传值汇总
- 保护自己的眼睛
- 教师对学生的项目评分——进程的同步与互斥
- 给Java SE 注入脚本语言的活力
- XML文件的应用
- C随机生成18位银行卡号
- IndexAction
- 使用Oracle Wrap工具加密你的代码