How will you update records with unique values in table by just using a single update statement ?
e.g.
Col1
----
1
1
2
2
3
o/p:
Col1
----
1
2
3
4
5
How will you update records with unique values in table by just using a single update statement ?
e.g.
Col1
----
1
1
2
2
3
o/p:
Col1
----
1
2
3
4
5
with cte as(
select col1, row_number() over(order by col1) rno
from #table_name
)
update cte set col1 = rno