Example: Identity Columns and INSERT ... SELECT - Analytics Database - Teradata Vantage

SQL Data Manipulation Language

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
ft:locale
en-US
ft:lastEdition
2025-04-02
dita:mapPath
pon1628111750298.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
esx1472246586715
lifecycle
latest
Product Category
Teradata Vantage™

Assume that column_1 of table_1 is a GENERATED BY DEFAULT identity column.

     INSERT INTO table_2 (column_1, column_2, column_3)
       VALUES (111,111,111);
     INSERT INTO table_2 (column_1, column_2, column_3)
       VALUES (222,222,222);
     INSERT INTO table_2 (column_1, column_2, column_3)
       VALUES (1,333,333);

     INSERT INTO table_1 (column_1, column_2, column_3)
     SELECT * FROM table_2;

Check the result of the insert operations by selecting all the rows from table_1.

     SELECT *
     FROM table_1;

Result:

     *** Query completed. 3rows found. 3 columns returned.
     *** Total elapsed time was 1 second.
      column_1  column_2  column_3
     --------- --------- ---------
           111       111       111
           222       222       222
             1       333       333