create function [dbo].[f_Get_StrArrayStrOfIndex_zsx] ( @str Nvarchar(max), --要分割的字符串 @split Nvarchar(1), --分隔符号 @index int --取第几个元素 ) returns varchar(1024) as begin set @str=@str+@split declare @result varchar(1024) declare @charindex int--当前位置 set @result= ''

if @index=1 begin set  @charindex=charindex(@split,@str) set @result=substring(@str,0,@charindex) end else begin while @index<>1--2 begin set  @charindex=charindex(@split,@str)--12 set @index=@index-1--1 set @str=substring(@str,@charindex+1,len(@str))--截取完的字符串 set  @charindex=charindex(@split,@str) set @result=substring(@str,0,@charindex) end end

return @result end

相关文章:

  • 2021-07-11
  • 2022-12-23
  • 2022-12-23
  • 2021-08-14
  • 2021-08-27
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-01-14
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-14
相关资源
相似解决方案