|
|
| |

I have duplicate identity value error. What can I do?
Answer:
You can run DBCC CHECKIDENT to correct this error. This error sometimes
occurs when you insert new rows.
This is the description of DBCC CHECKIDENT from the SQL Server 6.5 BOL:
DBCC CHECKIDENT [(table_name)]
Checks the current identity value and compares it with the maximum value
in the identity column. If the current identity value is invalid, it will
be reset using the maximum value in the identity column. Invalid identity
information can cause SQL Server message 2627 when a PRIMARY KEY or UNIQUE
KEY constraint exists on an identity column.
|
You can make stored procedure, which will check the identity field and
make this sp as sturtup (by using the sp_makestartup stored procedure).
This is the test example:
use master
go
CREATE PROCEDURE sp_checkident AS
EXEC ('use pubs
DBCC CHECKIDENT (jobs)')
go
sp_makestartup sp_checkident
go
|
Try to create an alert on error 2626 also.
|
|
|