Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
Unique Index on duplicate value column

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
Author Message
simimathew

New User


Joined: 26 Jan 2006
Posts: 17
Location: London

PostPosted: Tue Jul 08, 2008 9:26 pm    Post subject: Unique Index on duplicate value column
Reply with quote

Hi,

1) Can a unique index be created on a column that already has duplicate values? I tried doing it on DB2 UDB and it is not letting me create a unique index.

2) But I remember having read somewhere that two nulls are considered to be equal for UNIQUE indexing purposes. How do you create a UNIQUE INDEX on an already existing nullable column?

3) Also could you please point out the difference between primary key and unique index?

Many Thanks,
Simi
Back to top
View user's profile Send private message
References
PostPosted: Tue Jul 08, 2008 9:26 pm    Post subject: Re: Unique Index on duplicate value column Reply with quote

ashimer

Senior Member


Joined: 13 Feb 2004
Posts: 311
Location: Bangalore

PostPosted: Wed Jul 09, 2008 3:02 pm    Post subject:
Reply with quote

Quote:

somewhere that two nulls are considered to be equal


Only a single null value is allowed in an UNIQUE indexing column ...

Primary key will not allow any NULL ...

Unique itself means no duplicates are allowed ...
Back to top
View user's profile Send private message
simimathew

New User


Joined: 26 Jan 2006
Posts: 17
Location: London

PostPosted: Wed Jul 09, 2008 3:18 pm    Post subject: Reply to: Unique Index on duplicate value column
Reply with quote

Thanks very much.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1