Cloning Records

The simplest way to populate your database with test data.

Moderators: JonathanWatts, David Atkinson, Anu Deshpande, Michelle Taylor, Lionel, Emma A, sherr

Cloning Records

Postby Daniel.Levine » Mon Feb 06, 2012 7:23 pm

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?
Daniel.Levine
 
Posts: 2
Joined: Mon Feb 06, 2012 7:20 pm

Postby james.billings » Tue Feb 07, 2012 9:47 pm

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.
james.billings
 
Posts: 1144
Joined: Wed Jun 16, 2010 11:10 am
Location: My desk.

Postby Daniel.Levine » Tue Feb 07, 2012 10:56 pm

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_.
Daniel.Levine
 
Posts: 2
Joined: Mon Feb 06, 2012 7:20 pm

Postby james.billings » Wed Feb 08, 2012 12:56 pm

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.
james.billings
 
Posts: 1144
Joined: Wed Jun 16, 2010 11:10 am
Location: My desk.


Return to SQL Data Generator 2

Who is online

Users browsing this forum: No registered users and 0 guests