All Forums Database
vnagakishore 1 post Joined 07/13
16 Jul 2013
Inserting a Record

All
I am new to Teradata and debugging a issue related to insert. I have two tables in teradata. Find below the definitions
CREATE SET TABLE TablePrimary ,NO FALLBACK ,
   NO BEFORE JOURNAL,
     NO AFTER JOURNAL,
     CHECKSUM = DEFAULT,
     DEFAULT MERGEBLOCKRATIO
     (
      NEXT_HI DECIMAL(19,0))
PRIMARY INDEX I_H_U_K ( NEXT_HI );
I have second table say TableSecondary which has a column referring to Next_hi in TablePrimary for the primary key. I would like to know If I insert a record in the TableSecondary, Do i need to insert the key value in TablePrimary?

Sun_shine_jgd 39 posts Joined 07/13
19 Jul 2013

If you want to define a refrential integrity constrain - there are 2-3 ways.
if its hard RI--> which as you said will have to insert record in the primary table before inserting in to foreign key (secondary table)
 
Soft RI--> just create the relation ship . But it doesnt need to have primary table to be inserted first.
 

You must sign in to leave a comment.