Cloning Records
Daniel.Levine
Posts: 3
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?
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
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.
Redgate Software
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_.
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.
Redgate Software