populating date dimension

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
dnat
Participant
Posts: 200
Joined: Thu Sep 06, 2007 2:06 am

populating date dimension

Post by dnat »

Hi,

Is there any predefined script or function or routine to populate the date dimension table. or how is it normally done?

I need the following in Date_dim

Date
Day number
Calender day number
Month Number.

Thanks
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Give a bit more thought to what might be useful things to have, given your day granularity. For example:
first day of current month
last day of current month
year number
financial year
weekday name
weekday number in week
ordinal day number in calendar year
ordinal day number in financial year
season
workday/nonworkday

Use a Row Generator stage to generate dates from a start date (the Epoch property) for as many days as you require in the dimension (the Limit property). Use appropriate functions in a Transformer stage to generate the other fields based on your requirements (for example DateToMonth).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

From what I've seen, 'normally' it's either loaded from a spreadsheet or there's a stored procedure of some kind that generates the data.
-craig

"You can never have too many knives" -- Logan Nine Fingers
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

I always use YYYYMMDD as the key. This works really well.
Mamu Kim
dnat
Participant
Posts: 200
Joined: Thu Sep 06, 2007 2:06 am

Post by dnat »

Thanks for your responses..I am trying to get the information whether it is stored procedure or sql scripts, but havent got anything which can be re-used..if anyone has the info, can you please pass it on to me..
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

The only people that will have 'that info' are people working at your company. :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

We did this in the past with SQL. We generated the SQL using BASIC routines.
Mamu Kim
Post Reply