Page 1 of 1

Date Values within some limit

Posted: Wed Jun 21, 2006 12:13 am
by Amarpreet
I have a scenario wherein I have to generate date values within some limit. I have to fetch min(cal_date) and max(cal_date) from my source table and generate date values within these values in my target table.
How can I pick these dates and generate the date values from min(cal_date) and max(cal_date) dynamically in my job?

Posted: Wed Jun 21, 2006 12:28 am
by balajisr
Try using column generator stage.

Posted: Wed Jun 21, 2006 12:36 am
by Amarpreet
But I don't want to hard code the limits, but have to pick them from source table. How can I achieve this by using column/row generator?

Posted: Wed Jun 21, 2006 12:48 am
by kumar_s
Have max(date) and Min(date) from the source, use transformer and stage variable to check till the limit of Max(date) and increment the current date by 1 for each record.

Posted: Wed Jun 21, 2006 12:50 am
by ray.wurlod
Use a Column/Row Generator stage with job parameters for the limits.

Posted: Wed Jun 21, 2006 1:35 am
by kumar_s
Passing parameter to the stages may require to split the job.

Posted: Wed Jun 21, 2006 1:35 am
by kumar_s
Passing parameter to the stages may require to split the job.

Posted: Wed Jun 21, 2006 2:15 am
by thompsonp
Which database are you using?

Do you only ever get 1 minimum value and 1 maximum value from the database, or do you get 1 min and 1 max for each set of key values in the source table i.e. are you grouping by some key values?

Posted: Thu Jun 22, 2006 11:08 am
by clshore
If you have a date dimension table in your DB, this is easy:

SELECT
dateColumn
FROM DateDimTable
WHERE dateColumn BETWEEN minDate AND Maxdate
ORDER BY dateColumn

Use this stream of date values to create your target records

Carter