Copy Foreign Tables | CREATE TABLE | VantageCloud Lake - Copying Foreign Tables - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
ft:locale
en-US
ft:lastEdition
2024-12-11
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905
To create a copy of a foreign table with same options as an existing foreign table, use the statement CREATE TABLE AS. The form of CREATE TABLE AS determines whether you must use the WITH NO DATA clause:
  • CREATE TABLE new_foreign_table AS original_foreign_table

    You must use the WITH NO DATA clause.

  • CREATE TABLE new_foreign_table AS (SELECT select_list FROM original_foreign_table)

    You can use either the WITH NO DATA or WITH DATA clause.

CREATE TABLE AS … WITH NO DATA copies the definition of original_foreign_table to new_foreign_table, and new_foreign_table accesses the same external data as original_foreign_table.

To copy the payload data from original_foreign_table into columns of new_foreign_table:
  1. Create a view of the foreign table and use CAST to name the columns.
  2. Use the INSERT … SELECT statement to copy the payload data into the columns.