Red Gate forums :: View topic - Datetime / Offset from column - request
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

Datetime / Offset from column - request

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



Joined: 25 Mar 2009
Posts: 5

PostPosted: Fri Aug 02, 2013 10:33 pm    Post subject: Datetime / Offset from column - request Reply with quote

Hi all,

I'm trying to use SQL Data Generator (version 2.0.3.1) 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! Smile
_________________
--
Hugo Kornelis
(SQL Server MVP and Friend of Red Gate)
Back to top
View user's profile Send private message
Brian Donahue



Joined: 23 Aug 2004
Posts: 6666

PostPosted: Mon Aug 05, 2013 10:54 am    Post subject: Reply with quote

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.

https://www.simple-talk.com/content/article.aspx?article=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.
Back to top
View user's profile Send private message
lvdancerdave



Joined: 12 Dec 2013
Posts: 2

PostPosted: Thu Dec 12, 2013 8:15 pm    Post subject: Reply with quote

Hugo:

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
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