Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Wed, 05 Mar 2008 @ 09:22:44 GMT


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


Subj:   Can I add composite primary key on table?
 
From:   kishore

Using below statement I had created a table.

     Create table VWPRODUCT_LEAF
         as (select * from vwproduct_leaf_rl) with no
data;

--> VWPRODUCT_LEAF_RL is a view.

--> VWPRODUCT_LEAF table created with all columns are with NULL.


By default first column(i.e. item_ID) taken as a primary key. But I need to make composite primary key(i.e. item_id,X,Y) on VWPRDODUCT_LEAF.

When I try to Alter table with below statement

     ALTER TABLE VWPRODUCT_LEAF_RPT
        ADD CONSTRAINT PK_VWPRODUCT_LEAF_RPT
        PRIMARY KEY  ( ITEM_ID, x,y);

     ERROR: 5323: Primary key column 'ITEM_ID' must be NOT NULL

When I try to alter table with below statement for make ITEM_ID as not null

     ALTER TABLE VWPRODUCT_LEAF_RPT ADD ITEM_ID NOT NULL;

     ERROR: ITEM_ID is a Primary Key cannot modify

Can any one tell me how can I add composite primary key to VWPRODUCT_LEAF? And how can I remove by default created Primary key on VWPRODUCT_LEAF?


Regards,

Kishore KK



     
  <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