 <p>Your update is a separate statement from the <code>select</code>. If you want to do this in an update, try:</p> <pre><code>WITH CTE AS ( SELECT rownum = ROW_NUMBER() OVER (ORDER BY p.BusinessEntityID), p.FirstName FROM Person.Person p ) UPDATE p SET FirstName = prev.FirstName FROM CTE p JOIN CTE prev ON prev.rownum = CTE.rownum - 1 WHERE CTE.FirstName IS NULL; </code></pre> <p>The <code>left join</code> isn't important here, because you are only changing rows where <code>FirstName IS NULL</code>. The <code>left join</code> would set the <code>NULL</code> value to itself.</p>