Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread How to alter a field to remove NOT NULL?
Wed, May 13 2009 9:52 AMPermanent Link

Rolf Frei

eicom GmbH

I have a datafield defined as following:

"Availability" SMALLINT NOT NULL DEFAULT 0

Now I must remove the NOT NULL restricion from this field. So I try to do
that with that SQL:

ALTER TABLE Parts REDEFINE "Availability" SMALLINT DEFAULT 0


The Problem is, that it doesn't remove the NOT NULL restriction. After the
Alter Table call, the DB-Field has still NOT NULL defined. Can't this be
done at all with SQL?

Regards
Rolf

Wed, May 13 2009 2:38 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Rolf,

<<I have a datafield defined as following:

"Availability" SMALLINT NOT NULL DEFAULT 0

Now I must remove the NOT NULL restricion from this field. So I try to do
that with that SQL:

ALTER TABLE Parts REDEFINE "Availability" SMALLINT DEFAULT 0

The Problem is, that it doesn't remove the NOT NULL restriction. After the
Alter Table call, the DB-Field has still NOT NULL defined. Can't this be
done at all with SQL? >>

Sure, use this instead:

ALTER TABLE Parts REDEFINE "Availability" SMALLINT NULLABLE DEFAULT 0

--
Tim Young
Elevate Software
www.elevatesoft.com

Thu, May 14 2009 11:23 AMPermanent Link

Rolf Frei

eicom GmbH

Ok I forgott to tell you, that I use DBSIAM 3 and here this seems not to
work. Instead to make the field nullable, it will rename the field to
Nullable. This NULLABLE work only with DBISAM 4 rigth? For V3 I think I must
use Table.RestructureTable. Is that correct?

Regards
Rolf


"Tim Young [Elevate Software]" <timyoung@elevatesoft.com> schrieb im
Newsbeitrag
news:316E43B2-A243-440D-9FC1-D19AD15227A8@news.elevatesoft.com...
> Rolf,
>
> <<I have a datafield defined as following:
>
> "Availability" SMALLINT NOT NULL DEFAULT 0
>
> Now I must remove the NOT NULL restricion from this field. So I try to do
> that with that SQL:
>
> ALTER TABLE Parts REDEFINE "Availability" SMALLINT DEFAULT 0
>
> The Problem is, that it doesn't remove the NOT NULL restriction. After the
> Alter Table call, the DB-Field has still NOT NULL defined. Can't this be
> done at all with SQL? >>
>
> Sure, use this instead:
>
> ALTER TABLE Parts REDEFINE "Availability" SMALLINT NULLABLE DEFAULT 0
>
> --
> Tim Young
> Elevate Software
> www.elevatesoft.com
>

Thu, May 14 2009 1:54 PMPermanent Link

"Robert"

"Rolf Frei [Team Elevate]" <rolf@eicom.ch> wrote in message
news:B0B24CC0-F47C-43F8-B8BD-C2ED85F124D0@news.elevatesoft.com...
> Ok I forgott to tell you, that I use DBSIAM 3

Rings a distant bell. Seem to recall I had to rename the field, create a new
field, set the values of the new field to the old field, then delete the old
field. Maybe there is a less ugly way.

Robert

Fri, May 15 2009 10:57 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Rolf,

<< Ok I forgott to tell you, that I use DBSIAM 3 and here this seems not to
work. Instead to make the field nullable, it will rename the field to
Nullable. This NULLABLE work only with DBISAM 4 rigth? For V3 I think I must
use Table.RestructureTable. Is that correct? >>

Yes, I believe that is the only option with V3.

--
Tim Young
Elevate Software
www.elevatesoft.com

Image