Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Wed, 30 Jul 2003 @ 13:04:41 GMT


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


Subj:   Re: User/Database DDL
 
From:   Tressler, Dara C.

I use a command to retrieve all the table names (from DBC.Tables) and write to a SQLfile. Then I execute the generated SQL. If you want only the table defs, I would do a .EXPORT to an output file before executing the .RUN and .EXPORT RESET. This will send only the show information to the output file.

     .EXPORT report FILE = "..\data\work\schema.sql"
     select 'show ' ||
            case TableKind WHEN 't' then 'table'
                           WHEN 'm' then 'macro'
                           WHEN 'p' then 'procedure'
                           WHEN 'v' then 'view'
                           ELSE 'unknown'
                 end ||
           'SSA.' || t.Tablename || ';'    (title '') from
     (select trim(Tablename) as tablename from dbc.tables where
databasename='ssa' ) as t
     order by 1
     ;

     .EXPORT RESET

     .RUN FILE ..\data\work\schema.sql

I tend to limit to a specific database/user, but if you leave the where clause off then it will grab the ddl for all databases.


Thanks,

Dara



     
  <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