midrange.com code scratchpad
Name:
DATE_DIM creation DDL
Scriptlanguage:
Plain Text
Tabwidth:
4
Date:
01/20/2016 10:49:09 pm
IP:
Logged
Description:
DDL for creating your DATE_DIM
Code:
  1. create table DATE_DIM (
  2.   D_DATE_SK integer not null
  3.  ,D_DATE DATE default null
  4.  ,D_MONTH_SEQ for column D_MSEQ integer default null
  5.  ,D_WEEK_SEQ for column D_WSEQ integer default null
  6.  ,D_QUARTER_SEQ for column D_QSEQ integer default null
  7.  ,D_PERIOD_SEQ for column D_PSEQ integer default null
  8.  ,D_YEAR integer default null
  9.  ,D_DOW integer default null
  10.  ,D_DAYOFWEEKINMONTH For Column D_DOWINM Integer Default Null
  11.  ,D_MOY integer default null
  12.  ,D_DOM integer default null
  13.  ,D_WOY integer default null
  14.  ,D_WEEKYEAR integer default null
  15.  
  16.  ,D_PERIOD integer default null
  17.  ,D_QOY integer default null
  18.  ,D_QTRWEEK integer default null
  19.  
  20.  ,D_FISCAL_YEAR for column D_F_YEAR integer default null
  21.  ,D_FISCAL_QUARTER for column D_F_QOY integer default null
  22.  ,D_FISCAL_PERIOD for column D_F_PERIOD integer default null
  23.  
  24.  ,D_FIRST_DOM for column D_FDOM integer default null
  25.  ,D_LAST_DOM  for column D_LDOM integer default null
  26.  ,D_FIRST_DOW for column D_FDOW integer default null
  27.  ,D_LAST_DOW  for column D_LDOW integer default null
  28.  ,D_SAME_DAY_LY for column D_LYDAY integer default null
  29.  ,D_SAME_DAY_LQ for column D_LQDAY integer default null
  30.  ,D_SAME_WEEK_LY for column D_LYWEEK integer default null
  31.  
  32.  ,D_DAY_NAME char(9) ccsid 37 default null
  33.  ,D_MONTH_NAME for column D_MOYN char(9) ccsid 37 default null
  34.  ,D_MONTH_ABRV for column D_MOYNA char(3) ccsid 37 default null
  35.  ,D_MONTH_YEAR for column D_MNYR char(8) ccsid 37 default null
  36.  ,D_QUARTER_NAME  for column D_QOYN char(7) ccsid 37 default null
  37.  ,D_FISCAL_QUARTER_NAME for column D_F_QOYN char(7) ccsid 37 default null
  38.  
  39.  ,D_HOLIDAY char(1) ccsid 37 default null
  40.  ,D_HOLIDAY_NAME for column D_HOLNAME Varchar(50) ccsid 37 default null
  41.  ,D_FOLLOWING_HOLIDAY for column D_FOLOWHOL char(1) ccsid 37 default null
  42.  ,D_WEEKEND char(1) ccsid 37 default null
  43.  ,D_MONTH_FIRST_SAT for column D_FIRSTSAT char(1) ccsid 37 default null
  44.  ,D_MONTH_FIRST_FULL_WEEK for column D_FIRSTFW char(1) ccsid 37 default null
  45.  ,D_MONTH_LAST_SAT for column D_LASTSAT char(1) ccsid 37 default null
  46.  ,D_MONTH_LAST_FULL_WEEK for column D_LASTFW char(1) ccsid 37 default null
  47.  
  48.  ,D_CURRENT_13_WEEKS for column D_CUR13WK char(1) ccsid 37 default null
  49.  
  50.  ,D_DATEYYMD decimal(8, 0) default null
  51.  ,D_DATEMDYY decimal(8, 0) default null
  52.  ,D_DATECYMD decimal(7, 0) default null
  53.  ,D_JULIAN decimal(7, 0) default null
  54.  ,D_CENTURY decimal(2, 0) default null
  55.  ,D_YEAR2 decimal(2, 0) default null
  56. );
  57.  
  58. label on table DATE_DIM
  59.  IS 'Date datastructure of all types of date values';
  60.  
  61. label on column DATE_DIM
  62. (
  63.  D_DATE_SK      is 'Date Unique         Seq Key'
  64. ,D_DATE         is 'Date'
  65. ,D_MONTH_SEQ    is 'Month               Seq Key'
  66. ,D_WEEK_SEQ     is 'Week                Seq Key'
  67. ,D_QUARTER_SEQ  is 'Quarter             Seq Key'
  68. ,D_PERIOD_SEQ   is 'Period              Seq Key'
  69. ,D_YEAR         is 'Year'
  70. ,D_DOW          is 'Day of              Week'
  71. ,D_DAYOFWEEKINMONTH is 'Day of              Week In             Month'
  72. ,D_MOY          is 'Month of            Year'
  73. ,D_DOM          is 'Day of              Month'
  74. ,D_WOY          is 'Week of             Year'
  75. ,D_WEEKYEAR     is 'Year for            Week'
  76. ,D_PERIOD       is 'Period              Year'
  77. ,D_QOY          is 'Quarter of          Year'
  78. ,D_QTRWEEK      is 'Quarter week of     Year'
  79. ,D_FISCAL_YEAR  is 'Fiscal              Year'
  80. ,D_FISCAL_QUARTER is 'Fiscal              Quarter'
  81. ,D_FISCAL_PERIOD  is 'Fiscal              Period'
  82. ,D_FIRST_DOM    is 'First               Day of              Month Id'
  83. ,D_LAST_DOM     is 'Last                Day of              Month Id'
  84. ,D_FIRST_DOW    is 'First               Day of              Week Id'
  85. ,D_LAST_DOW     is 'Last                Day of              Week Id'
  86. ,D_SAME_DAY_LY  is 'Same Day            Last                Year Id'
  87. ,D_SAME_DAY_LQ  is 'Same Day            Last                Quarter Id'
  88. ,D_SAME_WEEK_LY is 'Same Week           Last                Year Id'
  89. ,D_DAY_NAME     is 'Day Name '
  90. ,D_MONTH_NAME   is 'Month Name'
  91. ,D_MONTH_ABRV   is 'Month               Abbrv'
  92. ,D_MONTH_YEAR   is 'Month Year          Name'
  93. ,D_QUARTER_NAME is 'Quarter             Name'
  94. ,D_FISCAL_QUARTER_NAME is 'Fiscal              Quarter             Name'
  95. ,D_HOLIDAY      is 'Is a                Holiday'
  96. ,D_HOLIDAY_NAME is 'Name of Holiday'
  97. ,D_FOLLOWING_HOLIDAY is 'Follows             a Holiday'
  98. ,D_WEEKEND      is 'Is a                Weekend'
  99. ,D_MONTH_FIRST_SAT is 'First               Saturday            of Month'
  100. ,D_MONTH_FIRST_FULL_WEEK is 'First               Full Week           of Month'
  101. ,D_MONTH_LAST_SAT is 'Last                Saturday            of Month'
  102. ,D_MONTH_LAST_FULL_WEEK is 'Last                Full Week           of Month'
  103. ,D_CURRENT_13_WEEKS is 'Day In              Current             13 Weeks'
  104. ,D_DATEYYMD     is 'Year                Month Day           Date'
  105. ,D_DATEMDYY     is 'Month Day           Year                Date'
  106. ,D_DATECYMD     is 'Century Year        Month Day           Date'
  107. ,D_JULIAN       is 'Julian              Date'
  108. ,D_CENTURY      is 'Century'
  109. ,D_YEAR2        is 'Year'
  110. ) ;
  111.  
  112. label on column DATE_DIM
  113. (
  114.  D_DATE_SK           text is 'Date Unique Seq Key'
  115. ,D_DATE              text is 'The Date'
  116. ,D_MONTH_SEQ         text is 'Month Seq Key'
  117. ,D_WEEK_SEQ          text is 'Week Seq Key'
  118. ,D_QUARTER_SEQ       text is 'Quarter Seq Key'
  119. ,D_PERIOD_SEQ        text is 'Period Seq Key'
  120. ,D_YEAR              text is 'Year'
  121. ,D_DOW               text is 'Day of Week'
  122. ,D_DAYOFWEEKINMONTH  text is 'Day of Week In Month'
  123. ,D_MOY               text is 'Month of Year'
  124. ,D_DOM               text is 'Day of Month'
  125. ,D_WOY               text is 'Week of Year'
  126. ,D_WEEKYEAR          text is 'Year for week when different than day year'
  127. ,D_PERIOD            text is 'Period Year'
  128. ,D_QOY               text is 'Quarter of Year'
  129. ,D_QTRWEEK           text is 'Quarter week of Year'
  130. ,D_FISCAL_YEAR       text is 'Fiscal Year'
  131. ,D_FISCAL_QUARTER    text is 'Fiscal Quarter'
  132. ,D_FISCAL_PERIOD     text is 'Fiscal Period'
  133. ,D_FIRST_DOM         text is 'First Day of Month Index Entry'
  134. ,D_LAST_DOM          text is 'Last Day of Month Index Entry'
  135. ,D_FIRST_DOW         text is 'First Day of Week Index Entry'
  136. ,D_LAST_DOW          text is 'Last Day of Week Index Entry'
  137. ,D_SAME_DAY_LY       text is 'Same Day Last Year Index Entry'
  138. ,D_SAME_DAY_LQ       text is 'Same Day Last Quarter Index Entry'
  139. ,D_SAME_WEEK_LY      text is 'Same Week Last Year Index Entry'
  140. ,D_DAY_NAME          text is 'Day Name '
  141. ,D_MONTH_NAME        text is 'Month Name'
  142. ,D_MONTH_ABRV        text is 'Month Abbrv'
  143. ,D_MONTH_YEAR        text is 'Month Name Selecting'
  144. ,D_QUARTER_NAME      text is 'Quarter Name'
  145. ,D_FISCAL_QUARTER_NAME text is 'Fiscal Quarter Name'
  146. ,D_HOLIDAY           text is 'Is a Holiday'
  147. ,D_HOLIDAY_NAME      text is 'Name of Holiday'
  148. ,D_WEEKEND           text is 'Is a Weekend'
  149. ,D_FOLLOWING_HOLIDAY text is 'Follows a Holiday'
  150. ,D_MONTH_FIRST_SAT   text is 'First Saturday of Month'
  151. ,D_MONTH_FIRST_FULL_WEEK text is 'First Full Week of Month'
  152. ,D_MONTH_LAST_SAT text is 'Last Saturday of Month'
  153. ,D_MONTH_LAST_FULL_WEEK text is 'Last Full Week of Month'
  154. ,D_CURRENT_13_WEEKS  text is 'This is the Current 13 Weeks'
  155. ,D_DATEYYMD          text is 'Numeric Year Month Day Date'
  156. ,D_DATEMDYY          text is 'Numeric Month Day Year Date'
  157. ,D_DATECYMD          text is 'Numeric Century Year Month Day Date'
  158. ,D_JULIAN            text is 'Julian Date'
  159. ,D_CENTURY           text is 'Century'
  160. ,D_YEAR2             text is 'Year'
  161. ) ;
© 2004-2019 by midrange.com generated in 0.008s valid xhtml & css