I have tables with no primary key that i want to mask.

KhaoulaKhaoula Posts: 1 New member
edited November 21, 2024 8:27PM in Data Masker for SQL Server
Hi,
I have tables 'without primary keys' to mask. I used the solution which consists of : 
using the command to create primary key + refresh indexes + command to delete previously created keys.
The creation of keys and the refresh index works well, but the substitution rule does not work.
I always have the same error 'NoPKorUniqueKeyException'.
Here is the log file.
Thank you in advance.
Tagged:

Answers

  • Eddie DEddie D Posts: 1,807 Rose Gold 5
    Hi Khaoula,
    Thank you for your forum post.

    For substitution rules requires that the table to be masked has a primary key, as per the second sentence in this help document.

    First introduced in V7.1.32, on creating a substitution rule on a table with no primary key, an Invalid Rule dialog appears, as per the image below:



    You simply need to click Convert to sync manager button.  This converts the substitution rule to become a Sync. Manger rule.

    • The Sync Manager rule creates a temporary table that is a copy of the table selected in the substitution rule, with one difference in that it has a primary key constraint. 
    • It populates the data from the live table into the temporary table.
    • Runs the substitution rule against the temporary table.
    • Using a Table to Table rule copies the masked data from the temporary table to the live table you originally selected for the substitution rule that has no primary key.
    • Finally drops the temporary table.  
    No requirement for the command rules to create a Primary Key and Indexes.  Although what you have configured will add the Primary key for the tables with no primary key, the Rule Controller is not freshed, so is still working on the fact there is no Primary Key.

    The conversion of each substitution rule whose table has no primary key, the conversion to Sync. Manager rule is the solution in your scenario.

    Many Thanks
    Eddie
    Eddie Davis
    Senior Product Support Engineer
    Redgate Software Ltd
    Email: support@red-gate.com
Sign In or Register to comment.