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