SQL Server, can't insert null into primary key field?

后端 未结 8 612
野趣味
野趣味 2020-12-03 10:46

I\'m about ready to rip my hair out on this one. I\'m fairly new to MS SQL, and haven\'t seen a similar post anywhere.

When I try to do a statement like this:

<
8条回答
  •  死守一世寂寞
    2020-12-03 11:21

    Assuming you have an autoincrement field for your primary Key you'll need to include the field list on your insert and not put a value for that field e.g.

    INSERT INTO qcRawMatTestCharacteristic 
    (Answer1,Answer2,...SomeDateField)
    VALUES(1,1,1,1,1,1,1,'','','', GETDATE(), 1)
    

提交回复
热议问题