WITH

AA (DocumentNo, ROW, ACol) AS

(

SELECT

DocumentNo,

(ROW_NUMBER() OVER (ORDER BY CONVERT(INT,ROW)) - 1) as ROW,

ACol

FROM '테이블' WITH(NOLOCK)

WHERE DOCUMENTNO = 59671

)

SELECT 

DOCUMENTNO

,ROW

,MAX(ACol) OVER (PARTITION BY DOCUMENTNO ORDER BY ROW) AS ACol

FROM AA