title: SQL Server equivalent to Oracle CONNECT BY and LEVEL pseudocolumn
body: <p>Please help converting Oracle query to SQL Server equivalent:</p>
  
  <pre><code>SELECT (LEVEL+1-1) AS lvl 
    FROM dual
  CONNECT BY LEVEL &lt;= 10
  /
  </code></pre>
  
  <p>The output is numbers from 1 to 10:</p>
  
  <pre><code>LVL
  ----
  1
  2
  3
  ...
  10
  </code></pre>
  
  <p>I know there is hierarchy methods in SQL Server and built-ins like <code>GetLevel</code> and more. Can this be used to get the same results?</p>
  
  <p>To create dual table if needed (not sure) - copied from here:<a href="http://blog.sqlauthority.com/2010/07/20/sql-server-select-from-dual-dual-equivalent/" rel="noreferrer">http://blog.sqlauthority.com/2010/07/20/sql-server-select-from-dual-dual-equivalent/</a></p>
  
  <pre><code>CREATE TABLE DUAL
  (
  DUMMY VARCHAR(1)
  )
  GO
  INSERT INTO DUAL (DUMMY)
  VALUES ('X')
  GO
  </code></pre>
  
  <p>Specifically looking for examples that would let use smth. like LEVEL in queries. For example: there is only one start date in the table - 4/22/2013. But with LEVEL I'm able to increment it as follows:</p>
  
  <pre><code>SELECT start_date, start_date+LEVEL-1 AS start_date_btwn
    FROM my_tab
   WHERE id = 1
  CONNECT BY LEVEL&lt;=10
  /
  
  START_DATE    START_DATE_BTWN
  ------------------------------
  4/22/2013    4/22/2013
  4/22/2013    4/23/2013
  4/22/2013    4/24/2013
  4/22/2013    4/25/2013
  ......
  4/22/2013    4/30/2013
  </code></pre>
  
  <p>Thank you very much to all in advance.</p>