Versuchen Sie Folgendes:
;WITH TEST AS
(
SELECT *,
ROW_NUMBER() OVER (ORDER BY id DESC) AS RowNo
FROM [UserTable]
)
UPDATE TEST
SET myindex = RowNo
Versuchen Sie Folgendes:
;WITH TEST AS
(
SELECT *,
ROW_NUMBER() OVER (ORDER BY id DESC) AS RowNo
FROM [UserTable]
)
UPDATE TEST
SET myindex = RowNo