Truncate table in Teradata

access_time 7 months ago visibility211 comment 0

In SQL Server, we can use TRUNCATE statement to clear all the records in a table and it usually performs better compared with DELETE statements as no transaction log for each individual row deletion.

The syntax looks like the following:

TRUNCATE TABLE { database_name.schema_name.table_name | schema_name.table_name | table_name }  
[;]  

Equivalent in Teradata

Unfortunately Teradata doesn't provide TRUNCATE TABLE statement. The similar statement is:

 DELETE TABLENAME ALL;
warning In previous Teradata version, there is performance differences between DELETE and DELETE ALL; however they are not equivalents and there is no performance differences according to Andrew Livingston from Teradata!

Code snippet

DELETE MYTDDB.MYTABLE ALL;


copyright This page is subject to Site terms.
Like this article?
Share on

Please log in or register to comment.

account_circle Log in person_add Register

Log in with external accounts

Want to publish your article on Kontext?

Learn more

Kontext Column

Created for everyone to publish data, programming and cloud related articles.
Follow three steps to create your columns.


Learn more arrow_forward

More from Kontext

local_offer teradata local_offer SQL local_offer teradata-sql-query

visibility 3177
thumb_up 0
access_time 4 years ago

For many SQL Server or Oracle developers, you may encounter some inconveniences when writing SQL queries. For example, how to select from dummy table or local defined variables. This page summarize the equivalents in Teradata SQL.

local_offer hive local_offer SQL local_offer hive-sql-ddl

visibility 46
thumb_up 0
access_time 3 months ago

This page shows how to create partitioned Hive tables via Hive SQL (HQL). Example: CREATE TABLE IF NOT EXISTS hql.transactions(txn_id BIGINT, cust_id INT, amount DECIMAL(20,2),txn_type STRING, created_date DATE) COMMENT 'A table to store transactions' PARTITIONED BY (txn_date DATE) STORED AS ...

local_offer teradata local_offer python local_offer Java local_offer python-database

visibility 1177
thumb_up 0
access_time 7 months ago

Python JayDeBeApi module allows you to connect from Python to Teradata databases using Java JDBC drivers. In article Connect to Teradata database through Python , I showed how to use teradata package to connect to Teradata via Teradata ODBC driver. This article demos how to use this JayDeBeApi ...

About column

Code snippets and tips for various programming languages/frameworks.

rss_feed Subscribe RSS