查找担保圈-step2-拆分成员表函数
2024-09-03 21:33:23
USE [test]
GO
/****** Object: UserDefinedFunction [dbo].[tf_split_char] Script Date: 2019/7/8 14:39:15 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER FUNCTION [dbo].[tf_split_char]
(
@cstring NVARCHAR(MAX), --被拆分的字符串
@csplit NVARCHAR(1) --分隔符
)
RETURNS @t TABLE
(
id INT IDENTITY(1, 1) PRIMARY KEY,
cchar NVARCHAR(MAX) NOT NULL
)
AS
BEGIN
DECLARE @ilocation INT = 0;
DECLARE @inextlocation INT = 1;
DECLARE @ilen INT;
WHILE @inextlocation > 0
BEGIN
SET @inextlocation = CHARINDEX(@csplit, @cstring, @ilocation + 1);
SET @ilen = CASE
WHEN @inextlocation > 0 THEN
@inextlocation
ELSE
LEN(@cstring) + 1
END - @ilocation - 1;
INSERT INTO @t
(
cchar
)
VALUES
(SUBSTRING(@cstring, @ilocation + 1, @ilen));
SET @ilocation = @inextlocation;
END;
RETURN;
END;
最新文章
- 在 C# 中执行 msi 安装
- DataSet, BindingSource, BindingNavigator Relationship
- GDI学习之俄罗斯方块续
- Jalopy 之 HelloWorld —— Jalopy 在 MyEclipse 下的安装与使用
- html笔记——网页中视频播放,文字滚动
- NpoiUtil
- Android设置虚线、圆角、渐变
- 办理卡尔加里大学(本科)学历认证『微信171922772』calgary学位证成绩单使馆认证University of calgary
- 2-SAT算法
- datatable的部分问题处理(动态定义列头,给某行添加事件,初始显示空数据)
- ECMA Script 6_行为重定义 Proxy
- Day 3-6 生成器&;迭代器
- js 中常用的循环
- golang: 利用unsafe操作未导出变量
- uoj #14.【UER #1】DZY Loves Graph
- 无线linux应用及配置--wifi配置
- P2322 [HNOI2006]最短母串问题
- 《转》python学习(6)序列类型-字符串
- mysql 数据操作 单表查询 where约束 like 模糊匹配
- ERROR 1130 (HY000): Host '192.168.0.190' is not allowed to connect to this MySQL serv
热门文章
- Qbxt 模拟题 day3(am) T3 选数字 (select)(贪心)
- 推荐系统系列(四):PNN理论与实践
- Marcin and Training Camp
- [题解] [HNOI2014] 世界树
- IDEA下载安装及绿色方法
- JDBC——数据库连接池以及JDBC代码模版模版
- 删除github上的一个repository
- vue 登录页面填坑
- vue路由在keep-alive下的刷新问题 对watch的影响
- phpstrom--------config php interpreter