0
votes

I am trying to insert a row into a table using the Insert statement, but I am getting the following error:

"System.Data.SqlClient.SqlException: 'Cannot insert the value NULL into column '[COLUMN_NAME]', table '[TABLE_NAME]'; column does not allow nulls"

I understand that this is happening because the ID column needs to be auto-incremented.

What I've tried:

  • right click on table --> Design --> change "identity specification" to "yes"
  • tried to tick the "allow Nulls" box (not allowed as it's a primary key)

How do I insert a row into a sql table with it automatically setting the id number? my understanding is that it should be doing this automatically.

1
can you share your create table script generated from management studio for the table WEB_TABLE_REFERENCE - DarkRob

1 Answers

1
votes

Please find this image and recheck your column setting.

enter image description here