What are the challenges you face when working across database platforms? Take the survey

Generating data based on another table

lfarringtonlfarrington Posts: 4
edited June 25, 2014 6:39AM in SQL Data Generator
I am new to Sql Data Generator. I have two tables which are related via a foreign key. For each row in the parent table, I want to create 12 rows in the child table (one for each month). So, my child table has a date field in it and I want 12 rows (one row for the first day of each month in the year.) What is the best generator to use to do this. I cannot figure out how without getting duplicates. Can you give me some tips here? Thanks in advance.


  • Options
    Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    To try to summarize the problem, you want something to accurately generate 12 dates, one for the first day of every month in the year.

    This is something that would require some very custom logic, using the Python generator. You'd need to write a function in Python that computes a date representing the first day of every month in the year. SQL Data Generator can mainly generate "random" data and doesn't have ways to generate data this specifically except through a custom script.

    I re-read this request several times, but I am still unclear about how the foreign-key relationship comes into this so I don't know if you need a cross-column generator. It doesn't sound like you need to base this data on data from another column.
Sign In or Register to comment.