Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Wed, 03 Jan 2007 @ 22:17:54 GMT


     
  <Prev Next>   <<First <Prev Next> Last>>  


Subj:   Re: Partition Table PPI automation
 
From:   Curley, David

Craig,

You should be able to use bteq to select the relevant dates into a string, export the results, and then run it.

Something like (may need some formatting, etc.)

     .os rm create_table.ddl
     .export file=create_table.ddl

     Select 'CREATE MULTISET TABLE dss_work.x_tbl
     
     PARTITION BY RANGE_N(date_invoice  BETWEEN
     DATE ''' || min(some_date) || ''' AND DATE ''' || max(some_date) || '''
     EACH INTERVAL ''7'' DAY);'
     >From source_table;

     .export reset

     .run file=create_table.ddl

You can play around with exactly how to structure it - maybe you just export that last line and concatenate it with a static file of the rest of the create table as an OS command, then run that. Or maybe there are spacing and wrapping issues, so you select each line of the create separately.

I did a similar thing to generate show table/view/trigger/etc statements for a given database into a separate file for each object, works a treat....


Dave Curley



     
  <Prev Next>   <<First <Prev Next> Last>>  
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023