标签:serve server sub arch bsp split max substring 功能
1 CREATE function [dbo].[Split] 2 ( 3 @SourceString nvarchar(max), 4 @Separator nvarchar(max)=‘,‘ 5 ) 6 returns @temp table(split nvarchar(128)) 7 --实现split功能 8 as 9 begin 10 11 declare @i int 12 set @SourceString=rtrim(ltrim(@SourceString)) 13 set @i=charindex(@Separator,@SourceString) 14 while @i>=1 15 begin 16 insert @temp values(left(@SourceString,@i-1)) 17 set @SourceString=substring(@SourceString,@i+1,len(@SourceString)-@i) 18 set @i=charindex(@Separator,@SourceString) 19 end 20 21 if @SourceString<>‘‘ 22 begin 23 insert @temp values(@SourceString) 24 end 25 return 26 27 end
标签:serve server sub arch bsp split max substring 功能
原文地址:https://www.cnblogs.com/61007257Steven/p/12880295.html