Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Mon, 19 Dec 2000 @ 01:43:48 GMT


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


Subj:   Re: Pasring a SQL select result
 
From:   Sam Mosley

     .set format on;
     .set width 80;
     .set pagelength 10000;
     .set foldline on 1,2,3,4;
     select 'delete from ' || trim(databasename) || '.' || trim(tablename) || 'all;' (char(80))(title ''),
              'insert into ' || trim(databasename) || '.' || trim(tablename) (char(80))(title ''),
              'select * from ' || trim(databasename) || '.' || trim(tablename) (char(80))(title ''),
              'where field1 in (select field1 from databasename.sampletable);' (char(80))(title ''),
              'collect statistics on ' || trim(databasename) || '.' ||
     trim(tablename) || ';' (char(80))(title '')
     from dbc.tables   /* or a table that you build with the databasename as a
     column and the tablename as another */
     where databasename = 'your_database'
       and   tablename = 'your_table'
     order by 1;

The foldline in BTEQ is what allows you to put the selected columns on a new line.

Apply this same concept to show tables, show views, show macros, collect statistics, even selecting data aggregations. It will save you lots of typing.

Sam Mosley
President
VLDB Systems, Inc.



     
  <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