generate data based on substring of current data

jputnamjputnam Posts: 4
edited August 10, 2016 7:31PM in SQL Data Generator
I want to anonymize an ID field, but not completely randomize. For instance, there are multiple rows in the table for the same person ID, and also records in another table that should be keyed together. What i want is to keep them all in sync - for instance, if the ID is 123456, i want to keep the last 3 digits but replace the first 3 with a static number - say 456. so in this example i'd end up with 456456 in every place 123456 was. Thoughts?

Comments

  • Andrew PAndrew P Silver 2 Posts: 193 Silver 2
    Hey jputnam,

    Thanks for contacting us!
    I don't know of any way you can do that- Data Generator does not run any Update statements- only Inserts- so it cannot update current records only insert new ones. The Inserts can come from another database however when they come over they are randomized and there is no good way to manipulate them.

    By default Data Generator keeps the FKs in Sync by pulling values from the new PKs to populate the FKs - more info here https://documentation.red-gate.com/disp ... generators

    I will follow up via email in case you have any questions or issues with the above!

    Warmly,
    Andrew Pierce
    Technical Sales Engineer
    Redgate Software
Sign In or Register to comment.