Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Tue, 02 Apr 2002 @ 23:14:06 GMT


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


Subj:   Alter table and RI
 
From:   Jim Downey

Hello,

I am creating some tables and then running an alter table after the table has been created to add a foreign key reference. I have not used the foreign key references in the past and am seeing something that I consider odd. After the alter table is complete, I have two copies of the altered table. One is fine, yet one has a _0 appended to the name and appears to be a ghost of the original table. Is this an expected result? What are the ramifications of deleting the ghost table. Why does the ghost table remain after the alter table command?

I am using queryman to view DBC.TABLES to see both descriptions of the table. The ghost is defined as version 1 and contains the alter table text while the 'good' version is defined as version 2 and contains the create table text.

We have maintained references programmatically in the past and I am experimenting with the referential integrity provided by Teradata. Does anyone have any advice on using the DBMS as opposed to programmatically?

This is the sequence of events:

CREATE SET TABLE CBR_1
,     NO FALLBACK
,     NO BEFORE JOURNAL
,     NO AFTER JOURNAL
(
... many columns
 )
UNIQUE PRIMARY INDEX
(
      REPORT_ID
)
;
CREATE SET TABLE CBR_2
,     NO FALLBACK
,     NO BEFORE JOURNAL
,     NO AFTER JOURNAL
(
... many columns
)
UNIQUE PRIMARY INDEX
(
      REPORT_ID
)
;
ALTER TABLE CBR_2 ADD FOREIGN KEY (REPORT_ID) REFERENCES CBR_1
(REPORT_ID);

Thanks

Jim



     
  <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