You haven't set the
IDENTITY
property on the
Id
column. As a result, every time you insert without specifying a value, it's trying to use the default value, which you've set to
0
.
The
Id
column is the primary key. You can't have more than one record in the table with the same primary key. Therefore, your insert fails with the error in your question.
Either specify the
Id
in your
INSERT
query, or set the
IDENTITY
property on that column.
IDENTITY (Property) (Transact-SQL) | Microsoft Docs[
^]