DDL Query to Drop Multiple Tables

Database
Enthusiast

DDL Query to Drop Multiple Tables

What is the query/syntax when you want to drop multiple tables from a database?

I want to use commit and rollback statement

 

Thank you

5 REPLIES 5
Teradata Employee

Re: DDL Query to Drop Multiple Tables

delete database xxxx ALL;

Teradata Employee

Re: DDL Query to Drop Multiple Tables

Note that Teradata does not support multiple DDL statements within a transaction; you must commit before issuing another request. 

Highlighted
Enthusiast

Re: DDL Query to Drop Multiple Tables

What is the commit and rollback statement?

Enthusiast

Re: DDL Query to Drop Multiple Tables

If you are trying to drop selected tables from the database, you can write a SELECT statement that generates the DROP statement, with the filter you need, and then run those drop statements.

Teradata Employee

Re: DDL Query to Drop Multiple Tables

It depends on session transaction semantics and whether or not "autocommit" by the driver is in effect. 

If you are using ANSI session with autocommit turned off, then you should explicitly end each transaction with a COMMIT or a ROLLBACK statement. (And the first / next request will automatically start a new transaction.)

If you are using Teradata session mode you can do explicit BEGIN TRANSACTION (or just BT) and then either END TRANSACTION (ET) or ROLLBACK.