当前位置:网站首页>[SQL] string series 2: split a string into multiple lines according to specific characters
[SQL] string series 2: split a string into multiple lines according to specific characters
2022-04-23 20:37:00 【Wood is easy to follow the wind】
Break a string into multiple lines according to specific characters , for example : Will Mathematics , Physics , history , biological , Chinese language and literature , English , chemical , Geographical division 8 Row display .
Select * From dbo.StrToColEx(' mathematics , Physics , history , biological , Chinese language and literature , English , chemical , Geography ',',') b
- 1.
CREATE function dbo.StrToColEx (@str Varchar(max),@separator varchar(10))
returns @T table(Col varchar(max),sort int)
as
Begin
Declare @i int
declare @index int
set @index=1
Set @i=0
Set @[email protected][email protected]
While(@i<=len(@str))
Begin
Insert @T select substring(@str,@i,charindex(@separator,@str COLLATE Chinese_PRC_CS_AS_KS_WS,@i)[email protected]) ,@index
Select @i=charindex(@separator,@str COLLATE Chinese_PRC_CS_AS_KS_WS,@i)+LEN(@separator)
set @[email protected]+1
End
return
End
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
版权声明
本文为[Wood is easy to follow the wind]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231922596556.html
边栏推荐
- Tensorflow 2 basic operation dictionary
- SQL: query duplicate data and delete duplicate data
- 缓存淘汰算法初步认识(LRU和LFU)
- 2022DASCTF Apr X FATE 防疫挑战赛 CRYPTO easy_real
- 內網滲透之DOS命令
- LeetCode 232、用栈实现队列
- How to protect ECs from hacker attacks?
- JSX syntax rules
- Shanghai a répondu que « le site officiel de la farine est illégal »: l'exploitation et l'entretien négligents ont été « noirs » et la police a déposé une plainte
- Modeling based on catiav6
猜你喜欢
Actual measurement of automatic ticket grabbing script of barley network based on selenium (the first part of the new year)
GO语言开发天天生鲜项目第三天 案例-新闻发布系统二
[latex] 5 how to quickly write out the latex formula corresponding to the formula
缓存淘汰算法初步认识(LRU和LFU)
go-zero框架数据库方面避坑指南
Linux64Bit下安装MySQL5.6-不能修改root密码
Syntax Error: TypeError: this. getOptions is not a function
Building the tide, building the foundation and winning the future -- the successful holding of zdns Partner Conference
【SQL】字符串系列2:将一个字符串根据特定字符分拆成多行
Tensorflow 2 basic operation dictionary
随机推荐
缓存淘汰算法初步认识(LRU和LFU)
【PTA】L2-011 玩转二叉树
Historical track data reading of Holux m1200-e Bluetooth GPS track recorder
RT-1052学习笔记 - GPIO架构分析
Analysis of the relationship between generalized Bim and CAD under the current background
MySQL stored procedures and functions
JDBC database addition, deletion, query and modification tool class
Install MySQL 5.0 under Linux 64bit 6 - the root password cannot be modified
一. js的深拷贝和浅拷贝
Solve the Chinese garbled code of URL in JS - decoding
ArcGIS JS version military landmark drawing (dovetail arrow, pincer arrow, assembly area) fan and other custom graphics
Recommend an open source free drawing software draw IO exportable vector graph
Learn to C language fourth day
6-5 字符串 - 2. 字符串复制(赋值) (10 分)C语言标准函数库中包括 strcpy 函数,用于字符串复制(赋值)。作为练习,我们自己编写一个功能与之相同的函数。
Click an EL checkbox to select all questions
Leetcode 1351. Negative numbers in statistical ordered matrices
Devexpress 14.1 installation record
A useless confession artifact
LeetCode 1351、统计有序矩阵中的负数
6-5 string - 2 String copy (assignment) (10 points) the C language standard function library includes the strcpy function for string copy (assignment). As an exercise, we write a function with the sam