网络营销学习网,沧州晚报,温永毅
sqlserver 使用函数实现分隔字符串
create function dbo.fn_split ( @str_source nvarchar(max), @split_char nvarchar(100) ) returns @temp table ( id int primary key identity(1,1), val varchar(max) ) as begin declare @idx int,@split_len int set @str_source=rtrim(ltrim(@str_source)) set @idx=charindex(@split_char,@str_source) set @split_len=len(@split_char) while(@idx>0) begin insert into @temp values(left(@str_source,@idx-1)) set @idx+=@split_len-1 set @str_source=substring(@str_source,@idx+1,len(@str_source)-@idx) set @idx=charindex(@split_char,@str_source) end if(@str_source!='') begin insert into @temp values(@str_source) end return end
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
数据库SQL---数据库、基本表、视图、索引的定义、修改、删除
在 Azure CentOS VM 中配置 SQL Server 2019 AG - (上)
在 Azure CentOS VM 中配置 SQL Server 2019 AG - (下)
网友评论