1 ALTER function [dbo].[字符串分段](@STR varchar(80),@x int,@jgf varchar(10)) 2 returns varchar(100) 3 begin 4 set @str=REPLACE(@str,' ','') 5 Declare @length int=len(@str) 6 Declare @index int=1 7 Declare @yhk varchar(100)='' 8 while @index<=@length 9 begin 10 set @yhk=iif(@yhk='',SUBSTRING(@str,@index,@x),@yhk+@jgf+SUBSTRING(@str,@index,@x)) 11 set @index=@index+@x 12 end 13 return @yhk 14 end
标签:varchar,分段,int,str,字符串,Declare From: https://www.cnblogs.com/ljtao/p/17630570.html