Hi all,
I tried to create a unique index with null values supporting the following command:
Code:
CREATE UNIQUE WHERE NOT NULL INDEX ON UNQ_IDX MYTABLE (MYFOREIGNKEY_ID)
DB2 and answers:
Code:
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0104N An unexpected token "WHERE NOT NULL" was found following "CREATE
UNIQUE ". Expected tokens may include: "<space>". SQLSTATE=42601
I work on DB2 V9.7 on AIX.
In the DB2 for z/OS documentation :
Code:
>>-CREATE--+----------------------------+--INDEX--index-name---->
'-UNIQUE--+----------------+-'
'-WHERE NOT NULL-'
but in the DB2 for Linux, UNIX, and Windows documentation :
Code:
>>-CREATE--+--------+--INDEX--index-name------------------------>
'-UNIQUE-'
the WHERE NOT NULL is not available !
I am looking for a way to create a UNIQUE constrains on the nullable column.
this command line does not work (a error is generated)
Code:
ALTER TABLE MYTABLE ADD CONSTRAINT UNQ UNIQUE (MYFOREIGNKEY_ID)
Thanks.
Nassa.