create function f_split(@c varchar(2000),@split varchar(2)) returns @t table(col varchar(20)) as begi
create function f_split(@c varchar(2000),@split varchar(2))
returns @t table(col varchar(20))
as
begin
while(charindex(@split,@c)<>0)
begin
insert @t(col) values (substring(@c,1,charindex(@split,@c)-1))
set @c = stuff(@c,1,charindex(@split,@c),"")
end
insert @t(col) values (@c)
return
end
Go
select * from dbo.f_split("dfkd,dfdkdf,dfdkf,dffjk",",")
drop function f_split
--结束END--
本文标题: SQL实用技巧:如何分割字符串
本文链接: https://lsjlt.com/news/2006.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-10-23
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0