RE: Error -1225 during conversion OnLine 5.01
Posted in 1995
The character for the decimal value of 0 (zero) is the NULL character.
In your alter table statement you are altering the field to type character
and disallowing nulls. When the engine builds the new table and then
trys to insert the records from the old table it returns the error of:
"-1225 Column does not admit a NULL value.
This statement attempted to store a null value in a column
that has been defined as not allowing nulls. Review the definition
of the table, and revise the statement so it supplies values for all
required columns."
Do the following:
create table t1 ( fld1 decimal (8) not null );
insert into t1 values (0) ; commit work ;
alter table t1 modify (fld1 char(8) l) ; update table t1 set fld1 = " 0" where fld1 is NULL;
alter table t1 modify (fld1 char(8) not null) ;
Or better yet do:
create table t1 ( fld1 char (8) not null );
insert into t1 values (" 0") ; commit work ;
Note: I assumed you wanted the 0 (zero) right justified.
if not leave out the leading spaces.
----------
From: ilist
To: internet!rmy.emory.edu!informix-list
Subject: Error -1225 during conversion OnLine 5.01
Date: Wednesday, June 07, 1995 2:39PM
Hi,
Another curiosity !!
If I...
create table t1 ( fld1 decimal (8) not null );
insert into t1 values (0) ; commit work ;
alter table t1 modify (fld1 char(8) not null) ;
I get error -1225 ( column does not admit a NULL value)
I know I can alter to char and then alter to not null,
I also know that if the first record does not contain 0
the original alter works fine.
Why does it do that ?
Tom Hogarty <Standard Disclaimers Apply>
SNI OnLine 5.01.U
Germany ANSI Mode Database
Tel : +49 52518-11602
Fax : +49 52548-27905
E-mail : hogarty.pad@sni.de