SQL Update with row_number()

后端 未结 8 1830
执笔经年
执笔经年 2020-11-27 03:07

I want to update my column CODE_DEST with an incremental number. I have:

CODE_DEST   RS_NOM
null        qsdf
null        sdfqsdfqsdf
null        qsdfqsdf
         


        
8条回答
  •  旧巷少年郎
    2020-11-27 03:22

    If table does not have relation, just copy all in new table with row number and remove old and rename new one with old one.

    Select   RowNum = ROW_NUMBER() OVER(ORDER BY(SELECT NULL)) , * INTO cdm.dbo.SALES2018 from 
    (
    select * from SALE2018) as SalesSource
    

提交回复
热议问题