SQL Server auto increment a column without primary key

前端 未结 2 1501
感动是毒
感动是毒 2021-01-04 03:53

Is it possible to auto increment a column in SQL Server WITHOUT it being a primary key?

If yes how can this be done.

Thanks

2条回答
  •  暖寄归人
    2021-01-04 04:35

    Declare the column with the IDENTITY keyword, and simply do not create a PRIMARY KEY constraint on it.

提交回复
热议问题