Home Page for the TeradataForum

Archives of the TeradataForum

Message Posted: Fri, 19 Jun 2009 @ 15:09:59 GMT

  <Prev Next>   <<First <Prev

Subj:   Re: Create statement for each table
From:   Geoffrey Rommel

  Basically I want to be able to load the results of SHOW TABLE for a list of tables into a varchar field in another table.  

Use Perl with Teradata::SQL, DBD::Teradata, or DBD::ODBC. The code will go something like this:

     $dbh = connect("dbc/bogart,bacall");

     foreach $t (@list_of_tables) {
      $dbh->"show table $t";
      # Process the SHOW TABLE output here. Most statements take one row; large
      # might take two or three. Note that the output includes carriage returns
     ("\r"), so
      # you'll probably want to change those to blanks or "\n".
      # Store the SHOW TABLE output in an array, @show.
      # Now store the output in your target table. Double the quotes if
      $dbh->"insert into target_table values ('@show');" ;

Hope this helps.

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