当前位置:网站首页>【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
边栏推荐
- 16MySQL之DCL 中 COMMIT和ROllBACK
- Rédaction de thèses 19: différences entre les thèses de conférence et les thèses périodiques
- XXXI` Prototype ` displays prototype properties and`__ proto__` Implicit prototype properties
- How to configure SSH public key in code cloud
- Solve the Chinese garbled code of URL in JS - decoding
- 內網滲透之DOS命令
- Actual measurement of automatic ticket grabbing script of barley network based on selenium (the first part of the new year)
- The market share of the financial industry exceeds 50%, and zdns has built a solid foundation for the financial technology network
- Monte Carlo py solves the area problem! (save pupils Series)
- Latest investigation and progress of building intelligence based on sati
猜你喜欢
内网渗透之DOS命令
Tensorflow 2 basic operation dictionary
Solution: NPM err! code ELIFECYCLE npm ERR! errno 1
2022DASCTF Apr X FATE 防疫挑战赛 CRYPTO easy_real
Handwritten Google's first generation distributed computing framework MapReduce
Devexpress 14.1 installation record
Syntax Error: TypeError: this. getOptions is not a function
上海回應“面粉官網是非法網站”:疏於運維被“黑”,警方已立案
Plato Farm元宇宙IEO上线四大,链上交易颇高
[PTA] get rid of singles
随机推荐
LeetCode 1346、检查整数及其两倍数是否存在
The construction and use of Fortress machine and springboard machine jumpserver are detailed in pictures and texts
Analysis of the relationship between generalized Bim and CAD under the current background
Scrapy教程 - (2)寫一個簡單爬蟲
go-zero框架数据库方面避坑指南
Leetcode 74. Search two-dimensional matrix
The ODB model calculates the data and outputs it to excel
2022dasctf APR x fat epidemic prevention challenge crypto easy_ real
[talkative cloud native] load balancing - the passenger flow of small restaurants has increased
Mathematical modeling column | Part 5: MATLAB optimization model solving method (Part I): Standard Model
三十.什么是vm和vc?
Tensorflow 2 basic operation dictionary
How can matlab obtain the truncated image in trainingimagelabeler
A login and exit component based on token
Go language development Daily Fresh Project Day 3 Case - Press Release System II
Plato farm is one of the four largest online IEOS in metauniverse, and the transaction on the chain is quite high
Scripy tutorial - (2) write a simple crawler
Click an EL checkbox to select all questions
LeetCode 116. Populate the next right node pointer for each node
【PTA】整除光棍