l.nethaji
New User
Joined: 16 Mar 2008 Posts: 90 Location: tamil nadu
|
|
|
|
Hi,
I am creating a table g3 as below
create table g3( a int not null with default, b varchar (10),unique(a))
when i try to do the below insert
insert into g3 (a,b) values(3,null),,,it working fine .
If i am trying to insert null into the a column which is unique its gives me a -407 error saying " insert into not null field).
So the definition of unique key says" we can insert only one null value into the unique key column".
So how can null vaues be inserted into the unique column AS we can't create a unique column without not null with default as definition.
Please explain and let me know if am going wrong anywhere.
Thank in advance,
L.Nethaji |
|
GuyC
Senior Member
Joined: 11 Aug 2009 Posts: 1281 Location: Belgium
|
|
|
|
depending on what you want :
Code: |
create table g3( a int with default, b varchar (10)) ;
create unique index g3x on test13(a); |
or
Code: |
create table g3( a int with default, b varchar (10)) ;
create unique where not null index g3x on test13(a); |
|
|