Update values in identity column

前端 未结 5 670
执笔经年
执笔经年 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:21

    You cannot update the Identity Column in SQL Server. You have to delete the original record, then Insert the record with the Identity value because there is no support for updating an identity value.

    set Identity_Insert [ColumnName] On Insert identity and additional information previously stored in that record set Identity_Insert [ColumnName] Off

提交回复
热议问题