Cloning Records

We have a desparate need to "clone" hundreds of dataobjects in a large db for training. A single "account" might have related records in 150+ tables.

The end goal is to have 200 exact duplicates of account 1234 across all of those tables. Even better would be exact duplicates, _except_ in a table that has names, which are custom built for each new account.

Can this tool do that?

Comments

  • Without knowing the details of your database it's hard to say - the way the tool works is to generate data based on various random generators, although it can also pull data using SQL Queries - so it would be simple enough as a starting point to create a blank copy of your database, and then populate it with a "copy" of the tables you're interested in using the option to "use an existing data source" at the table level, or alternatively a query to pull records in at the column level.

    How well duplicates work will depend on the relationships and keys in your database though. We don't have a simple "make a copy of table X and repeat it 20 times" option though.
    Systems Software Engineer

    Redgate Software

  • Hey, James!

    I think I wasn't quite clear with the requirements. In a simple example, let's say we have a customer who has placed three orders for a few different products each time. Say that is customer #123, with order#6567, 6598, and 6895.

    If we wanted to clone that customer, we would end up with an exact duplicate customer with a new ID (say, 754) and that "clone" would also have three orders, which woudl be exact copies of 123's three orders.

    So, we need to insert a record into Customers that generates a new ID and then creates new Orders that are duplicates of the original customer's orders, which also have new ID's.

    The issue is that our data model will require parent/child relationships over 150 tables.

    So, can the tool be told to add records through the data structure, but instead of using "randomized" content, can it duplicate specificed existing content?

    We'd really love to buy the product, but the requirement is absolute--we need to know it can do _exactly this_.
  • I don't think it's going to be able to.

    When you generate data, the stuff it generates is basically on a column-by-column level basis. It doesn't have any way to configure cross-column or cross-table "rules".

    I can't think of a way off the top of my head to do precisely what you describe - you could potentially copy records from a source db into, say, the orders table, and let SQL Server assign new PK values for the ID (and just copy everything else) but there's no way to tell it to link these generated rows back to a freshly generated "customer" for instance.
    Systems Software Engineer

    Redgate Software

Sign In or Register to comment.