Q&A about the site for engineers, producers, editors, and enthusiasts spanning the fields of video, and media creation
declare @S varchar(max) set @S = '14029,13678,23531,29886,28571,13211,14029,15882,16864,17881,20563,21673,23531,24400,25836,27220,29218,29219,29920,31508' declare @l int while len(@S) > 0 begin --print left(@S, charindex(',', @S+',')-1) set @l = left(@S, charindex(',', @S+',')-1) print @l set @S = stuff(@S, 1, charindex(',', @S+','), '') end