Originally posted by Ovidiu
I sort the table .... ORDER BY col_1 (in reality more that one column)
The col_2 is empty / Null and I want to update the col_2 with this value: 1, 2, 3 ,4 ..........
declare table @Temp(col_1 type,col_2 int identity(1,1))
insert @temp select distinct col_1 from originaltable order by col_1
update originaltable set col_2=t.col_2 from originaltable as ot join @Temp as t on ot.col_1=t.col_1