 <p>You can use a <a href="https://msdn.microsoft.com/en-us/library/ms175972.aspx" rel="nofollow">cte</a> for that:</p> <pre><code>;With cte as ( SELECT [id], Row_number() OVER(Order by [id] As rn FROM MyTable ) UPDATE MyTable SET recNum = rn FROM MyTable t INNER JOIN cte ON(t.[id] = cte.[id]) </code></pre> <p>However, you since already have an id column that seems to have the values you are asking for, you can simply do this:</p> <pre><code>UPDATE MyTable SET recNum = [id] </code></pre>