I am trying to update one column based on another column short. I am using order by
, but while using select top(10000)
my incremental number going 4000 series but I need from 101, but initially I declare int 100
DECLARE @IncrementValue int
SET @IncrementValue = 100
UPDATE CabecDoc
SET CDU_NumberBook = @IncrementValue,
@IncrementValue = @IncrementValue + 1
FROM
(SELECT TOP(7000) *
FROM CabecDoc
WHERE data BETWEEN '2019-05-01' AND '2019-07-17'
AND Entidade = 'VD4'
AND tipodoc = 'VD' AND CDU_SimbolBook = '*'
ORDER BY NumDoc ASC) CabecDoc
I need update column from 101 to an incremental number through 7000 records.