Archives of the TeradataForum
Message Posted: Fri, 02 Feb 2007 @ 18:50:35 GMT
Subj: | | Re: How to dump all object definitions in a database |
|
From: | | Vinay Bagare |
This script should help you
.SET WIDTH 254
.SET TITLEDASHES OFF
.SET ERROROUT STDOUT
.RUN FILE Logon.txt
.OS IF EXIST Ddl.sql DEL Ddl.sql
.OS IF EXIST Ddl_txt.txt DEL Ddl_txt.txt
.EXPORT REPORT FILE = DDl.sql
SELECT
CASE WHEN TableKind = 'T' THEN 'SHOW TABLE ' || TRIM(DatabaseName) ||
'.' || TRIM(TableName) || ';'
WHEN TableKind = 'V' THEN 'SHOW VIEW ' || TRIM(DatabaseName) ||
'.' || TRIM(TableName) || ';'
WHEN TableKind = 'M' THEN 'SHOW MACRO ' || TRIM(DatabaseName) ||
'.' || TRIM(TableName) || ';'
WHEN TableKind = 'P' THEN 'SHOW PROCEDURE ' || TRIM(DatabaseName)
|| '.' || TRIM(TableName) || ';'
END (TITLE '')
FROM DBC.Tables
WHERE DatabaseName = 'SYSDBA';
.EXPORT RESET
.EXPORT REPORT FILE = Ddl_txt.txt
.RUN FILE Ddl.sql
.EXPORT RESET
.LOGOFF
.QUIT
Thanks,
Vinay Bagare
Amp'd Mobile Inc
www.ampd.com
|