title: Get value depending of current iteration on while loop
body: <p>Currently I'm using SQL Server Management Studio v18, and I want to iterate a <code>Table Type</code> using a while loop, so I do:</p>
  <pre><code>CREATE TYPE [VarcharIdTableType] AS TABLE
  (
      [FileName] VARCHAR(MAX)
  )
  </code></pre>
  <p>Then I use a while loop as:</p>
  <pre><code>DECLARE @FileTableType [VarcharIdTableType]
  
  INSERT INTO @FileTableType 
  VALUES ('test1'),('test2'),('test3')
  
  DECLARE @FileCount INT = (SELECT COUNT(*) FROM @FileTableType), @RowCount INT = 0
  
  WHILE @RowCount &lt;= @FileCount
  BEGIN                  
      DECLARE @Content VARCHAR(555)= CONCAT('File name ', @filename)
  
      SET @RowCount = @RowCount + 1;
  END
                 
  </code></pre>
  <p>So I want to get each FileName depending of iteration number, how can I achieve that?</p>