Cannot uniquely identify row

A table in the database has no primary key but contains an element that prevents the addition of temporary identifiers.

This could be due to an existing column being defined as an identity column.

Redgate Anonymize requires a way to uniquely identify rows during the masking process. When a table lacks a primary key, the tool attempts to add a temporary identifier column. However, this fails when:

  • the table contains an identity column that conflicts with temporary ID generation.
  • the table has other constraints that prevent column addition.
  • insufficient permissions exist to modify the table structure.

How to fix

Add a temporary primary key to the table before masking, then remove it afterwards.

Option 1: Add a temporary primary key

Using your database management tool or preferred SQL client:

  1. Add a temporary primary key column to the problematic table.
  2. Run your masking operation.
  3. Remove the temporary primary key after masking completes.

Option 2: Add a permanent primary key

If the table should have a primary key for data integrity:

  • Identify existing columns that could serve as a unique identifier.
  • Add a primary key constraint using these columns.
  • This is the recommended long-term solution for data quality.



Didn't find what you were looking for?