1
I need to update a database table by changing a column with the auto increment value but I must take into account a sort, I managed to update with the following code with auto increment but not able to do taking into account the ordering, the sorting field is in the same update table with the name Description.
DECLARE @count int
SET @count = 0
update MinhaTabela set Codigo = @count, @count=@count+1
Very good worked out I did not know CTE I have little knowledge with MSSQL, I’ll give a studied up to understand better. OBG
– Fernando josé