If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > DB2: Create primary key on partition table?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-09-11, 22:34
nmcuong nmcuong is offline
Registered User
 
Join Date: Jul 2011
Posts: 10
Red face DB2: Create primary key on partition table?

Hi all !

In DB2, I want to create primary key on partition table. How can I do it?

Example:

Create table TEMP1:

CREATE TABLE TEMP1 (
ID INTEGER NOT NULL,
DATEREPORT VARCHAR(8) NOT NULL,
NUMBERREPORT VARCHAR(20),
TITLE VARCHAR,
YEAR INTEGER,
IDCOM INTEGER,
IDTEN INTEGER DEFAULT 0 NOT NULL
)DISTRIBUTE BY HASH (IDTEN, YEAR);

After that, I want to create primary key on ID column but not yet because error:

SQL0270N Function not supported Reason code = "1")'

The command to create PRIMARY KEY:

ALTER TABLE TEMP1 ADD CONSTRAINT PK_TEMP1
PRIMARY KEY(ID);

How can I do?

Thanks !
Reply With Quote
  #2 (permalink)  
Old 08-09-11, 22:58
db2girl db2girl is offline
∞∞∞∞∞∞
 
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 1,816
SQL0270N Function not supported (Reason code = "<reason-code>").

Explanation:

The statement cannot be processed because it violates a restriction as
indicated by the following reason code:

1

The primary key, each unique constraint, and each unique index
must contain all distribution columns of the table (columns may
appear in any order).
Reply With Quote
  #3 (permalink)  
Old 08-09-11, 23:11
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
Are you trying to use the Table Partitioning feature, or using DPF (Data Partitioning Feature, aka InfoSphere Warehouse)?

When using DPF (DISTRIBUTE BY HASH), you almost always want to use a non-meaningful column to get an even distribution of data across the nodes. Unless you are just playing around with a Try-and-Buy version, it is a little disconcerting that someone would purchase InfoSphere Warehouse (or DPF add-on for an older release of DB2) without knowing this. I would strongly suggest that your company hire a consultant to get you started in the right direction, or else you may end with a gigantic mess.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #4 (permalink)  
Old 08-10-11, 02:20
przytula_guy przytula_guy is offline
Registered User
 
Join Date: Apr 2006
Location: Belgium
Posts: 1,159
if help needed - always available..
__________________
Best Regards, Guy Przytula
Database Software Consultant
DB2 UDB LUW Certified V7-V8-V9-V9.7 DB Admin - Dprop..
Information Server Datastage Certified
http://www.infocura.be
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On