Setting Identity to on or off in SQL server

后端 未结 4 1325
情深已故
情深已故 2021-02-12 18:26

I want to set Is Identity property of a column to off and after inserting an explicit value setting it to on again.I\'ve written this query :

SET IDENTITY_INSERT         


        
4条回答
  •  悲哀的现实
    2021-02-12 18:51

    You actually want to use SET IDENTITY_INSERT Tbl_Cartoons ON before attempting to insert explicit values.

    You're saying that "I am going to be responsible for inserting values into the IDENTITY column".

    SET IDENTITY_INSERT Tbl_Cartoons OFF says "I'll let the system take responsibility for inserting values into the IDENTITY column".

提交回复
热议问题