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. How can I do? Thanks !
-
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. How can I do? Thanks !
use google: http://sqlzoo.net/howto/source/z.dir/tip241027/i02create.xml[^]
In Word you can only store 2 bytes. That is why I use Writer.
-
use google: http://sqlzoo.net/howto/source/z.dir/tip241027/i02create.xml[^]
In Word you can only store 2 bytes. That is why I use Writer.
-
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. How can I do? Thanks !
As far as I know you cannot create a primary key without including all the columns in distribute list. So basically you either have to: - include ID in the distribute list - define the primary key using IDTEN and YEAR and ID
The need to optimize rises from a bad design.My articles[^]
-
As far as I know you cannot create a primary key without including all the columns in distribute list. So basically you either have to: - include ID in the distribute list - define the primary key using IDTEN and YEAR and ID
The need to optimize rises from a bad design.My articles[^]