Red Gate forums :: View topic - Cloning Records
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SQL Data Generator 2
SQL Data Generator 2 forum

Cloning Records

Search in SQL Data Generator 2 forum
Post new topic   Reply to topic
Jump to:  
Author Message
Daniel.Levine



Joined: 06 Feb 2012
Posts: 2

PostPosted: Mon Feb 06, 2012 7:23 pm    Post subject: Cloning Records Reply with quote

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?
Back to top
View user's profile Send private message
james.billings



Joined: 16 Jun 2010
Posts: 1120
Location: My desk.

PostPosted: Tue Feb 07, 2012 9:47 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Daniel.Levine



Joined: 06 Feb 2012
Posts: 2

PostPosted: Tue Feb 07, 2012 10:56 pm    Post subject: Reply with quote

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_.
Back to top
View user's profile Send private message
james.billings



Joined: 16 Jun 2010
Posts: 1120
Location: My desk.

PostPosted: Wed Feb 08, 2012 12:56 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group