Datetime / Offset from column - request

The simplest way to populate your database with test data.

Datetime / Offset from column - request

Postby HugoKornelis » Fri Aug 02, 2013 9:33 pm

Hi all,

I'm trying to use SQL Data Generator (version to generate extra data for the FactResellerSales table in the AdventureWorksDW2012 sample database. But in order to make it match the pattern of the rest, I find that some features are missing from Data Generator.

One of them is for generating the ShipDate. I have set OrderDate to be generated at random; ShipDate should always be a few days later (I'd like the delay to be random between 4 and 10 days). I can do that with the standard datetime generator, setting range to "Offset from column". However, this generator does not allow me to force the time part to always be zero.

(I could of course change the data type of the column to date, but I want the schema to remain equal to the original AdventureWorks. And there are probably other people too who can't just cahnge the data type in order to generate more realistic data.)

Is there a way to do this with the current product and I just fail to see it? And if not, is there a wishlist where I can add this?

Thanks in advance! :)
Hugo Kornelis
(SQL Server MVP and Friend of Red Gate)
Posts: 5
Joined: Wed Mar 25, 2009 9:48 am

Postby Brian Donahue » Mon Aug 05, 2013 9:54 am

Thanks for writing Hugo. The situation with SQL Data Generator is still that you can't derive a field of generated data from a field of generated data in a different column of the same table.

I usually suggest one of two solutions, none of which are particularly easy. One is to use the Ruby generator - that is a third-party addition which allows you to create data from Ruby scripts and supports manipulation of generated data so you can "derive" values from a different column. ... rticle=697

The second would be to use the Python generator on both columns and use a predictable set of numbers - for instance if you generate a random sequence of numbers in both columns based on the same "seed", you can just increment the value in the second column by +4.

There should be some examples on this forum about generating some random numbers in Python.
Brian Donahue
Posts: 6590
Joined: Mon Aug 23, 2004 9:48 am

Postby lvdancerdave » Thu Dec 12, 2013 7:15 pm


I'm new to the Red Gate Data Generator as well. While it may not be the best solution, you can edit project... -> Scripts and then choose to run a post data generation script that sets the time part to zero in the desired field.
David Burt
Posts: 2
Joined: Thu Dec 12, 2013 4:54 pm

Return to SQL Data Generator Previous Versions

Who is online

Users browsing this forum: No registered users and 0 guests