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

前端 未结 8 1296
暖寄归人
暖寄归人 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:50

    This will depend on the database but for SQL Server, this could be achieved as follows:

    alter table Example
    add NewColumn int identity(1,1)
    

提交回复
热议问题