Adding an identity to an existing column

后端 未结 19 2048
温柔的废话
温柔的废话 2020-11-21 13:16

I need to change the primary key of a table to an identity column, and there\'s already a number of rows in table.

I\'ve got a script to clean up the IDs to ensure

相关标签:
19条回答
  • 2020-11-21 14:11

    If you happen to be using Visual Studio 2017+

    1. In Server Object Explorer right-click on your table and select "view code"
    2. Add the modifier "IDENTITY" to your column
    3. Update

    This will do it all for you.

    0 讨论(0)
提交回复
热议问题