当前位置:网站首页>【SQL】字符串系列2:将一个字符串根据特定字符分拆成多行
【SQL】字符串系列2:将一个字符串根据特定字符分拆成多行
2022-04-23 20:32:00 【木易随风】
将一个字符串根据特定字符分拆成多行,例如:将数学,物理,历史,生物,语文,英语,化学,地理分成成8行显示。
Select * From dbo.StrToColEx('数学,物理,历史,生物,语文,英语,化学,地理',',') 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.
版权声明
本文为[木易随风]所创,转载请带上原文链接,感谢
https://blog.51cto.com/muyi/5248737
边栏推荐
- 高薪程序员&面试题精讲系列91之Limit 20000加载很慢怎么解决?如何定位慢SQL?
- Azkaban recompile, solve: could not connect to SMTP host: SMTP 163.com, port: 465 [January 10, 2022]
- 上海回应“面粉官网是非法网站”:疏于运维被“黑”,警方已立案
- The market share of the financial industry exceeds 50%, and zdns has built a solid foundation for the financial technology network
- Vscode download speed up
- Numpy mathematical function & logical function
- Don't bother tensorflow learning notes (10-12) -- Constructing a simple neural network and its visualization
- Error reported by Azkaban: Azkaban jobExecutor. utils. process. ProcessFailureException: Process exited with code 127
- GO語言開發天天生鮮項目第三天 案例-新聞發布系統二
- Leetcode 1337. Row K with the weakest combat effectiveness in the matrix
猜你喜欢
Installation and use of NVM
Scripy tutorial - (2) write a simple crawler
DOS command of Intranet penetration
Modeling based on catiav6
Livego + ffmpeg + RTMP + flvjs to realize live video
Commit and rollback in DCL of 16 MySQL
Leetcode 994, rotten orange
Handwritten Google's first generation distributed computing framework MapReduce
RT-1052学习笔记 - GPIO架构分析
Operation of numpy array
随机推荐
Sqoop imports tinyint type fields to boolean type
Latest investigation and progress of building intelligence based on sati
[PTA] l1-006 continuity factor
Analysis of the relationship between generalized Bim and CAD under the current background
上海回应“面粉官网是非法网站”:疏于运维被“黑”,警方已立案
The construction and use of Fortress machine and springboard machine jumpserver are detailed in pictures and texts
How do BIM swindlers cheat? (turn)
【问题解决】‘ascii‘ codec can‘t encode characters in position xx-xx: ordinal not in range(128)
Solution: NPM err! code ELIFECYCLE npm ERR! errno 1
Click an EL checkbox to select all questions
bounding box iou
LeetCode 542、01 矩阵
An error is reported when sqoop imports data from Mysql to HDFS: sqlexception in nextkeyvalue
LeetCode 1346、检查整数及其两倍数是否存在
Commit and rollback in DCL of 16 MySQL
Leetcode 74. Search two-dimensional matrix
Actual measurement of automatic ticket grabbing script of barley network based on selenium (the first part of the new year)
star
Servlet learning notes
BMP JPEG 图片转换为矢量图像 ContourTrace