I would like to replace the while loop below by cursor, I tried many example but I did not succeed up to now , can you help me on this please ?
set @tableboundary =( select count(*) as counts from @From_T)
while @counter < @tableboundary
begin
set @Enti = (select Entities from @From_T where id= @counter)
Insert into @Temp_Tamale ( Entities) select value FROM MarMo.dbo.udf_ParseInto(@Enti, ',', '', '')
set @counter = @counter + 1
end
Why would you want to use a cursor when you can use a single SQL statement?
Insert into @Temp_Tamale (Entities)
select value
from @From_T t cross apply
MarMo.dbo.udf_ParseInto(t.Entities, ',', '', '');