SlowJoe wrote:
> Hi Michael,
>
> just create a UNIQUE INDEX on that column.
> Regards,
>
> Johannes
>
>
>
>
> Michael Kleiser wrote:
>
>>Is it possibe to define a table
>>to allow NULL-values and also defining this column to be unique.
>>
>>In Oracle this is possible. It is also possible to insert more
>>tahn one row with NULL in this column.
>>
>>
>>In DB2 this seems not be possible. I got error SQLSTATE=42831
>>if I try to add an unique-constraint on a NULL-column.
>>
>>( version 8.1 on 32 bit Linux )
>>
>>
>>Is there a way to get the oracle-behaviour ?
>>Do I have to write a trigger to simulate it ?
>>
>>regards
>> Michael
>>
Thank you, this helps somewhat.
But now I have an other problem:
I did:
CREATE TABLE t ( email VARCHAR(100), name VARCHAR(100) NOT NULL ):
CREATE UNIQUE INDEX ix_t ON t ( email )
INSERT INTO t ( email,name ) VALUES ( NULL, 'Michael' )
INSERT INTO t ( email,name ) VALUES ( NULL, 'Peter' )
The second insert results in "SQLSTATE=23505" !
>>
>>---------------------------------------------------------------------
>>PLEASE CLICK REPLY-ALL TO SEND A REPLY TO EVERYONE
>>website: http://www.LazyDBA.com
>>To unsubscribe: http://www.lazydba.com/unsubscribe.html
>>
>>
>
>
>
> ---------------------------------------------------------------------
> PLEASE CLICK REPLY-ALL TO SEND A REPLY TO EVERYONE
> website: http://www.LazyDBA.com
> To unsubscribe: http://www.lazydba.com/unsubscribe.html
>
DB2 & UDB email list listserv db2-l LazyDBA home page