Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Mon, 10 Jan 2005 @ 09:33:00 GMT


     
  <Prev Next>   <<First <Prev
Next>
Last>>
 


Subj:   Re: Drop table with RI constraints
 
From:   vimala.cherukuri

Hi,

There is no specific syntax for dropping tables with referential integrity constraints.

The normal 'DROP TABLE' syntax is used to drop them but it must be ensured that the referencing(Child) tables are dropped before the referenced(Parent) tables, otherwise 'Failure 5313' is returned.

     Example:
     --------

     CREATE SET TABLE t1 ,NO FALLBACK ,
          NO BEFORE JOURNAL,
          NO AFTER JOURNAL,
          CHECKSUM = DEFAULT
          (
           a INTEGER NOT NULL,
           b INTEGER,
           c INTEGER)
     UNIQUE PRIMARY INDEX ( a );

     CREATE SET TABLE t2 ,NO FALLBACK ,
          NO BEFORE JOURNAL,
          NO AFTER JOURNAL,
          CHECKSUM = DEFAULT
          (
           a1 INTEGER,
           b1 INTEGER,
           c1 INTEGER,

     FOREIGN KEY ( a1 ) REFERENCES T1 ( a ))
     PRIMARY INDEX ( a1 );


      BTEQ -- Enter your DBC/SQL request or BTEQ command:

     DROP TABLE t1;

     DROP TABLE t1;
      *** Failure 5313 Referential integrity violation: cannot drop a referenced

      (Parent) table.
                     Statement# 1, Info =0

      *** Total elapsed time was 1 second.


      BTEQ -- Enter your DBC/SQL request or BTEQ command:

     DROP TABLE t2;

     DROP TABLE t2;

      *** Table has been dropped.

      *** Total elapsed time was 1 second.


      BTEQ -- Enter your DBC/SQL request or BTEQ command:

     DROP TABLE t1;

     DROP TABLE t1;

      *** Table has been dropped.

      *** Total elapsed time was 1 second.

Thanks,

Vimala.



     
  <Prev Next>   <<First <Prev
Next>
Last>>
 
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023