When i try to insert into the table with this pk (auto incremental)
[foo] [bigint] IDENTITY(1,1) NOT NULL,
I get the following error message:
Msg 2627, Level 14, State 1, Procedure foobar, Line 39 [Batch Start Line 2]
Violation of PRIMARY KEY constraint 'PK_bar'. Cannot insert duplicate key in object 'table_foo'. The duplicate key value is (9).
The statement has been terminated.
(1 row affected)
- we do not try to write into the identity column
- There are around 4mio records in the table, so max pk value is not the issue. Another procedure which writes into this table works fine.