Violation of Primary Key constraint 'RDRIDX'

Symptom


When adding a new reader from a migrated system such as FCWNX, an error is generated that prevents the reader from being created:

"Violation of Primary Key constraint 'RDRIDX'. Cannot insert duplicate key in object 'dbo.RDR_CARDFORMATS'. The duplicate key value is 1, 4, 1).
The statement has been terminated."

Resolution

 
This issue is caused by an existing entry in the database. The entry can be found by running a simple query against the dbo.RDR_CARDFORMATS table in the AccessControl database.
 
  1. Select * from RDR_CARDFORMATS where PANELID=x and READERID=x
    This shows all entries in this table for the PANELID matching the one generated in the error and the corresponding READERID. 
  2. To verify this reader does not already exist, run the following query against the READER table:
    Select * from READER where PANELID=x and READERID=x
  3. If no entries are present in the database for this READERID, the entries from the RDR_CARDFORMATS table can be deleted. Before doing so, perform a database backup.
    Delete from RDR_CARDFORMATS where PANELID=x and READERID=x
  4. After processing the query in the database, go back to System Administration and attempt to create the reader again. This should now allow the reader to be created without generating an error message.

Applies To

 
 
OnGuard (all versions)
 
 

Additional Information


Always create a new database backup before running any queries that will modify records in the database.