title: Row_Number in table with key where ordering does not make sense
body: <p>I am using T-SQL. </p>
  
  <p>I have a temporary table <code>#t2</code> with only one column called <code>internal</code>.</p>
  
  <p>Values of the column are <code>n</code> times a sequence from 1 to 3 </p>
  
  <p>i.e. : 1 2 3 1 2 3 1 2 3 ...</p>
  
  <p>I want to add this column to another temporary table <code>#t1</code> which only has a column of dates called <code>Date</code> (assuming that the number of rows of the two table is the same). </p>
  
  <p>If I want to use a join, I need an <code>on</code> clause, but I do not have any key that would make sense. Moreover, <code>cross join</code> does not work since multiplies the number of columns. Hence, I thought to add a <code>row_number</code> to each table and inner join on the newly formed row_number columns. </p>
  
  <p>However, row_number requires an <code>order by</code> clause and while <code>#t1</code> contains the column <code>Date</code> which makes sense to sort on, table <code>#t2</code> does not, so the row_number solution does not work either.</p>
  
  <p>I tried to add a column <code>id</code> to table <code>#t2</code> and add a row_number using a while loop but the column <code>id</code> is only populated by <code>NULL</code> values. </p>
  
  <pre><code>ALTER TABLE #t2
  ADD id integer;
  
  declare @iterFlag integer
  declare @iteration2 integer
  set @iteration2 = (select count(internal) from #t2)
  --print @iteration2
  
  set @intFlag = 1
  while (@intFlag &lt;= @iteration2)
  begin
  
          INSERT INTO  #t2 (id)
          VALUES (@intFlag)
  
  
  SET @intFlag = @intFlag + 1
  end;
  go
  </code></pre>
  
  <p>If instead of using </p>
  
  <pre><code>INSERT INTO  #t2 (id)
  VALUES (@intFlag)
  </code></pre>
  
  <p>I use: </p>
  
  <pre><code>UPDATE #t2
  SET id = @intFlag
  </code></pre>
  
  <p>then I only get the result of <code>(select count(internal) from #t2)</code>.</p>
  
  <p>Do you have any solution that would make me stack the two columns one next to each other?</p>