Why is SQL server throwing this error: Cannot insert the value NULL into column 'id'?

前端 未结 13 1445
鱼传尺愫
鱼传尺愫 2020-11-27 05:35

I\'m using the following query:

INSERT INTO role (name, created) VALUES (\'Content Coordinator\', GETDATE()), (\'Content Viewer\', GETDATE())
13条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-27 06:29

    @curt is correct, but I've noticed that sometimes even this fails with NULL disallowed errors, and it seems to be intermittent. I avoided the error at all times, by also setting the Indenty Seed to 1 and IDENTITY(1, 1) NOT FOR REPLICATION.

提交回复
热议问题