An explicit value for the identity column in table 'Table' can only be specified when a column list is used and IDENTITY_INSERT is ON

前端 未结 3 1931
一整个雨季
一整个雨季 2021-01-25 14:52

Does someone know what this error (An explicit value for the identity column in table \'HD_AANVRAAG_FASE\' can only be specified when a column list is used and IDENTITY_INSERT

3条回答
  •  醉话见心
    2021-01-25 15:23

    Since you aren't specifying the columns explicitly, I assume @fase_id is being passed into an IDENTITY column, which as the error indicates you can't do unless you force it via IDENTITY_INSERT.

    Usually, you let the DB generate this; specify the columns in the INSERT and omit the identity column (and don't try to assign a value). The straight after the INSERT your new id is available as SCOPE_IDENTITY().

提交回复
热议问题