sql 循环分割字符串
作者:互联网
DECLARE @rifd nvarchar(max) ='E28068940000500344B33D71,E280689400004006A010FD4C'
DECLARE @i INT=0,@j INT=0
DECLARE @distribution_code VARCHAR(100)
SET @rifd=@rifd+','
DECLARE @itemindex INT=CHARINDEX(',',@rifd)
WHILE(@rifd!=','AND @itemindex>0)--拆分字符串,循环输出
BEGIN
DECLARE @orderNo VARCHAR(1000)
SET @orderNo= left(@rifd,@itemindex-1)
SELECT @orderNo
set @rifd=right(@rifd,len(@rifd)-@itemindex)
set @itemindex=charindex(',',@rifd)
END
标签:分割,set,INT,rifd,sql,字符串,orderNo,DECLARE,itemindex 来源: https://www.cnblogs.com/yichen89/p/14469157.html