Is it possible to create a carbon copy of an identity table in a different database?

Database

Is it possible to create a carbon copy of an identity table in a different database?

I have the following identity table 

 

CREATE SET TABLE my_database1.my_table ,FALLBACK ,
     NO BEFORE JOURNAL,
     NO AFTER JOURNAL,
     CHECKSUM = DEFAULT,
     DEFAULT MERGEBLOCKRATIO
     (
      p_id BIGINT GENERATED ALWAYS AS IDENTITY
           (START WITH 1             INCREMENT BY 1             MINVALUE 1 
MAXVALUE 922337203685477580 NO CYCLE), created_by VARCHAR(20) , salary INTEGER, bonus INTEGER, created_ts TIMESTAMP(6)) UNIQUE PRIMARY INDEX ( p_id );

This table has already over 100,000 rows. I need to create the exact carbon copy of this table in `database2`, also Teradata. However, the p_id doesn't seem to want to copy there. Is it possible?

 

How to copy an identity table with data from one database to another? 


Accepted Solutions
Teradata Employee

Re: Is it possible to create a carbon copy of an identity table in a different database?

P_id in the copy table either has to be defined as just BIGINT without the IDENTITY definition or as GENERATED BY DEFAULT rather than GENERATED ALWAYS. GENERATED ALWAYS will not allow a value to be provided for the column.

1 ACCEPTED SOLUTION
1 REPLY
Teradata Employee

Re: Is it possible to create a carbon copy of an identity table in a different database?

P_id in the copy table either has to be defined as just BIGINT without the IDENTITY definition or as GENERATED BY DEFAULT rather than GENERATED ALWAYS. GENERATED ALWAYS will not allow a value to be provided for the column.