Update values in identity column

前端 未结 5 675
执笔经年
执笔经年 2020-12-08 02:26

How do I override the identity column in MSSQL? I tried :

    SET IDENTITY_INSERT GeoCountry ON
    UPDATE GeoCountry SET CountryID = 18 WHERE C         


        
5条回答
  •  心在旅途
    2020-12-08 03:10

    If you want to reenumerate the values of an identity field, because for instance the values have gone mad, just do as follows:

    • open table in design mode click on Identity Specification

      mark (is identity) as NO (Your identity field is still a PK)

      close and save design

    • open table in edit mode Change the values of your Identity field as desired (just be aware you cannot have duplicate values)

    • Close the table and open it again in design mode Replace your identity field (is identity) to Yes.

      Close the table and you are done.

提交回复
热议问题