Archives of the TeradataForum
Message Posted: Tue, 13 Jul 2004 @ 12:22:54 GMT
Subj: | | Re: If Exists Then ...Else .... |
|
From: | | Rob Paller |
TeradataForum wrote:
| In MS SQL, you can use IF EXISTS to validate the existance of a table, if it exists you drop it else carry on with code. | |
| What is the equivalent in code in Teradata Queryman ? | |
I believe it will be a two step process in Teradata
Step 1:
SEL "DROP TABLE ' || TRIM(DATABSENAME) || '.' || TRIM(TABLENAME) || '';'
FROM DBC.TVM
WHERE DATABASENAME =
AND TABLENAME IN (, , );
Step 2:
Take the results and execute them.
I am not sure if a Stored Procedure in Teradata would allow the DROP statement to execute. If it does, you can load a cursor with the SQL
in STEP 1 then roll through the cursor on statement at a time and execute the drop statements.
--
Rob Paller
Teradata Certified Master
|