title: create while loop with cte
body: <p>how to create sql server cte from a while loop<br>
  my loop like this </p>
  
  <pre><code>  declare @ind as int
    declare @code as nvarchar
    set @ind  = 0
     while @ind &lt; 884
    begin
      select @ind  = @ind  + 1
      --here execute Procedure 
          --and set return value to variable 
      set @code = cast (@ind   as nvarchar)
    end
  </code></pre>