Add a column to existing table and uniquely number them on MS SQL Server

前端 未结 8 1290
暖寄归人
暖寄归人 2020-12-04 08:16

I want to add a column to an existing legacy database and write a procedure by which I can assign each record a different value. Something like ad

8条回答
  •  醉酒成梦
    2020-12-04 08:32

    for oracle you could do something like below

    alter table mytable add (myfield integer);
    
    update mytable set myfield = rownum;
    

提交回复
热议问题