Q&A for experienced flyers, pilots, and builders of drones and model aircraft
declare @WorkorderIDExisiting bigint = 4285979548 declare @S varchar(20) set @S = '1,2,3,4,5' while len(@S) > 0 begin print left(@S, charindex(',', @S+',')-1) --print @WorkorderIDExisiting set @WorkorderIDExisiting=cast (left(@S, charindex(',', @S+',')-1)as bigint); set @S = stuff(@S, 1, charindex(',', @S+','), '') end