title: SQL to get next not null value in column
body: <p>How can I get next not null value in column? I have MSSQL 2012 and table with only one column. Like this:</p>
  
  <pre><code>rownum    Orig
  ------    ----
  1         NULL
  2         NULL
  3         9
  4         NULL
  5         7
  6         4
  7         NULL
  8         9
  </code></pre>
  
  <p>and I need this data:</p>
  
  <pre><code>Rownum    Orig    New
  ------    ----    ----
  1         NULL    9
  2         NULL    9
  3         9       9
  4         NULL    7
  5         7       7
  6         4       4
  7         NULL    5
  8         9       5
  </code></pre>
  
  <p>Code to start:</p>
  
  <pre><code>declare @t table (rownum int, orig int);
  insert into @t values (1,NULL),(2,NULL),(3,9),(4,NULL),(5,7),(6,4),(7,NULL),(8,9);
  select rownum, orig from @t;
  </code></pre>