Update values in identity column

前端 未结 5 676
执笔经年
执笔经年 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 are trying to update an identity column here is one possible approach:

    • In SQL Server Management Studio, open the table in design view, disable "Identity Specification > Is Identity" on the column
    • Perform updates
    • Enable "Identity Specification > Is Identity" on the column

    Do a SELECT IDENT_CURRENT('

    ') to see if it returns the highest id that is currently present in the table.

    提交回复
    热议问题