title: Replacing empty rows with previous non null values in SQL
body: <p>I have a simple table(<strong>header table</strong>) in SQL server with following columns:</p>
  <pre><code>name  Eng1 Eng2 Eng3 updateby updateddate
  adobe ,  ,Alex,Bob ,John, 2020-09-29 13:10:00
  adobe ,Clint, , ,John,    2020-09-29 13:12:00
  adobe , ,Mary,  ,John,    2020-09-29 13:14:00
  adobe ,Sheila ,,  ,John,  2020-09-29 14:10:00
  </code></pre>
  <p>I want to <em><strong>fill empty rows with previous non null data,if any</strong></em>. So, the resultant table/view should become:</p>
  <pre><code>     name  Eng1 Eng2 Eng3 updateby updateddate
      adobe ,     ,Alex,Bob,John, 2020-09-29 13:10:00
      adobe ,Clint,Alex,Bob,John,    2020-09-29 13:12:00
      adobe ,Clint,Mary,Bob,John,    2020-09-29 13:14:00
      adobe ,Sheila,Mary,Bob,John,  2020-09-29 14:10:00
  </code></pre>
  <p>I am using below view but it fails to provide the solution:</p>
  <pre><code>WITH RANKTABLE AS
  (
      SELECT *,ROW_NUMBER() OVER (ORDER BY name,updateddate) rnk 
      FROM Header
  )
  
  SELECT name,
      (SELECT TOP 1 Eng1 FROM RANKTABLE a WHERE a.rnk = 
      (SELECT MAX(b.rnk) FROM RANKTABLE b WHERE b.rnk &lt;= c.rnk AND b.Eng1 IS NOT NULL)) as Eng1_Updated,
  
      (SELECT TOP 1 Eng2 FROM RANKTABLE a WHERE a.rnk = 
      (SELECT MAX(b.rnk) FROM RANKTABLE b WHERE b.rnk &lt;= c.rnk AND b.Eng2 IS NOT NULL)) as Eng2_Updated,
  
      (SELECT TOP 1 Eng3FROM RANKTABLE a WHERE a.rnk = 
      (SELECT MAX(b.rnk) FROM RANKTABLE b WHERE b.rnk &lt;= c.rnk AND b.Eng3  IS NOT NULL)) as Eng3_Updated
  From RANKTABLE c
  </code></pre>