当前位置:网站首页>【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
边栏推荐
- bounding box iou
- Parsing methods of JSON data in C - jar and jobobject: error reading jar from jsonreader Current JsonReader item
- Servlet learning notes
- Preliminary understanding of cache elimination algorithm (LRU and LFU)
- Identification of bolt points in aerial photography based on perception
- Leetcode 994, rotten orange
- Modeling based on catiav6
- 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
- star
- Es error: request contains unrecognized parameter [ignore_throttled]
猜你喜欢
Numpy Index & slice & iteration
Installation and use of NVM
Click an EL checkbox to select all questions
Sqoop imports tinyint type fields to boolean type
2022dasctf APR x fat epidemic prevention challenge crypto easy_ real
SQL Server Connectors By Thread Pool | DTSQLServerTP plugin instructions
LeetCode 116. 填充每个节点的下一个右侧节点指针
A useless confession artifact
Mathematical modeling column | Part 5: MATLAB optimization model solving method (Part I): Standard Model
Scripy tutorial - (2) write a simple crawler
随机推荐
JDBC tool class jdbcconutil gets the connection to the database
Es error: request contains unrecognized parameter [ignore_throttled]
JS arrow function user and processing method of converting arrow function into ordinary function
After route link navigation, the sub page does not display the navigation style problem
bounding box iou
Rédaction de thèses 19: différences entre les thèses de conférence et les thèses périodiques
Go zero framework database avoidance Guide
A login and exit component based on token
[talkative cloud native] load balancing - the passenger flow of small restaurants has increased
How can matlab obtain the truncated image in trainingimagelabeler
GO语言开发天天生鲜项目第三天 案例-新闻发布系统二
三十一. `prototype`显示原型属性和`__proto__`隐式原型属性
Zdns was invited to attend the annual conference of Tencent cloud basic resources and share the 2020 domain name industry development report
Mathematical modeling column | Part 5: MATLAB optimization model solving method (Part I): Standard Model
Some basic configurations in interlij idea
Research on open source OCR engine
BMP JPEG picture to vector image contourtrace
LeetCode 74、搜索二维矩阵
上海回應“面粉官網是非法網站”:疏於運維被“黑”,警方已立案
Use the rolling division method to find the maximum common divisor of two numbers