|
|
Archives of the TeradataForum
Message Posted: Thu, 04 Jan 2007 @ 12:08:32 GMT
Subj: | | Re: Partition Table PPI automation |
|
From: | | Ferry, Craig |
Thanks for all the great input. Just to have a working version in the archive, I used the following script to create my table. I put all but
the partition line in the margin_detail.ddl file and then ran this script. Works like a charm.
Craig
.os rm /dba/dss/dbtest/craig_test/excep_rpt/margin_detail_x.ddl
.os rm /dba/dss/dbtest/craig_test/excep_rpt/x_append.ddl
.os rm /dba/dss/dbtest/craig_test/excep_rpt/x_temp.ddl
.os cp /dba/dss/dbtest/craig_test/excep_rpt/margin_detail.ddl
/dba/dss/dbtest/craig_test/excep_rpt/margin_detail_x.ddl
.export indicdata file=/dba/dss/dbtest/craig_test/excep_rpt/x_temp.ddl
.set INDICDATA OFF
.SET FORMAT OFF
.SET WIDTH 254
Select 'PARTITION BY RANGE_N(date_invoice BETWEEN DATE ''' ||
add_months((date - extract(day from date) + 1),-12)
|| ''' AND DATE ''' || CAST(MAX(date_invoice) AS DATE FORMAT
'''YYYY-MM-DD''') || ''' EACH INTERVAL ''7'' DAY);'
FROM dss_tables.dly_sales;
.export reset
.os sed "s/''/'/g" /dba/dss/dbtest/craig_test/excep_rpt/x_temp.ddl >
/dba/dss/dbtest/craig_test/excep_rpt/x_append.ddl
.os cat /dba/dss/dbtest/craig_test/excep_rpt/x_append.ddl >>
/dba/dss/dbtest/craig_test/excep_rpt/margin_detail_x.ddl
.run file=/dba/dss/dbtest/craig_test/excep_rpt/margin_detail_x.ddl
| |