Home Page for the TeradataForum

Archives of the TeradataForum

Message Posted: Fri, 02 Feb 2007 @ 17:46:33 GMT

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

Subj:   Re: How to dump all object definitions in a database
From:   Dempsey, Mike

You can do the same thing - without the stored procedure - by using an SQL Assistant Import.

First get a list of all the Tables/Views etc in the database that you want to dump the DDL of, and write this to a tab delimited text file.

(You need 2 columns - the object type [TABLE, VIEW, etc.] and the object name)

You can use the following SQL for this:

     SELECT CASE TableKind
            WHEN 'T' THEN 'TABLE'
            WHEN 'V' THEN 'VIEW'
            WHEN 'M' THEN 'MACRO'
            WHEN 'P' THEN 'PROCEDURE'
            END, TableName
     FROM dbc.tables
     WHERE TableKind IN ('T', 'V', 'M', 'P')
     AND DatabaseName = 'YourDB'

Then switch on Import mode and run the following query:

     SHOW ? ?

(First set your default database to the one you want to dump, and point to the file you created above when it asks for the import file.)

Alternatively you can select 3 columns including the databasename and use the statement

     SHOW ? ? ?

This will create a file containing the DDL of all the objects. The file name will be the same as the import file name but with ".log" appended.

Mike Dempsey
Teradata Client Tools

  <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: 28 Jun 2020