SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
Test data generator and constraints

 
Reply to topic    SoftTree Technologies Forum Index » SQL Assistant View previous topic
View next topic
Test data generator and constraints
Author Message
ssandu



Joined: 26 Feb 2007
Posts: 95
Country: Romania

Post Test data generator and constraints Reply with quote
Hi
I want to change data from AdventureWorksLT2008R2 sample database and I want to generate some data with data generator.
But there are some constraints there and I don't know how to deal them.
For example a ShipDate must be greater then OrderDate.
How can I solve that with Test Data Generator.
Thank's
Sat Feb 05, 2011 1:14 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7847

Post Reply with quote
I suggest doing that in 2 steps.

1. Generate a couple of work tables and use them for lookup values. For example, create TEMP_OrderDate and TEMP_ShipDate. Using Data-generator populate both tables with some values and pick different minimum and maximum start date values. Basically build a collection of dates in TEMP_ShipDate that is greater than values in TEMP_OrderDate.

2. In the project in which you want to populate Orders table, you can choose TEMP_OrderDate and TEMP_ShipDate as source data tables for populating OrderDate and ShipDate columns.

If creating lookup tables is not an option, you can achieve the same results by using text files. For example, you can generate some sample dates in Excel and save them to TXT files, then use saved files as data source for other tables.

Please note that lookup tables and files don't need to be large, they only need to store a limited collection of values, which the data-generator can use to create random or non-random sets of values in the destination tables.

Another tip, if business rules are complex, you can use data-generator to populate data in staging tables ina different schema and then use relatively simple INSERT…SELECT queries to copy data from staging tables to destination tables applying additional rules as needed, for example
INSERT INTO Sales.Orders SELECT … OrderDate + day(ShipDay) AS ShipDate … FROM Staging.Orders
Sun Feb 06, 2011 4:12 pm View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » SQL Assistant All times are GMT - 4 Hours
Page 1 of 1

 
Jump to: 
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
Design by Freestyle XL / Flowers Online.