Nulls information in system tables
Posted in 2006
Topics: Server Administration
Does anyone know where I can find if a column can contain nulls in the
system tables.
I've searched in syscolumns, sysconstraints, sysdefaults etc and I can't
find this info.
dbschema, dbaccess all know about columns that are "not null" so this info
must be stored somewhere ..
TIA
Arturo Koosau wrote:
> Does anyone know where I can find if a column can contain nulls in the
> system tables.
> I've searched in syscolumns, sysconstraints, sysdefaults etc and I can't
> find this info.
> dbschema, dbaccess all know about columns that are "not null" so this
> info must be stored somewhere ..
The information is encoded into the type column of the syscolumns table
record for the column. In pseudocode the test is:
if ((syscolumns.coltype & 0x0100) == 0)
ColumnCanBeNull = TRUE
ColumnIsNotNull = FALSE
else
ColumnIsNotNull = TRUE
ColumnCanBeNull = FALSE
endif
In ESQL/C you can use the define SQLNONULL contained in
$INFORMIXDIR/incl/esql/sqltypes.h
To extract the actual datatype use:
SqlDataType = syscolumns.coltype & SQLTYPE; /* SQLTYPE is defined as 0xFF */
Art S. Kagel
create table tessie ( a int , b int not null);
select a.* from syscolumns a , systables b
where a.tabid = b.tabid and b.tabname ='tessie'
colname a
tabid 114
colno 1
coltype 2 <<<<<<<<<<<<----------------------
collength 4
colmin
colmax
extended_id 0
colname b
tabid 114
colno 2
coltype 258 <<<<<<<<<<<<<<<<<------------------ 256 + 2.......
collength 4
colmin
colmax
extended_id 0
See you
Superboer.
Arturo Koosau schreef:
> Does anyone know where I can find if a column can contain nulls in the
> system tables.
> I've searched in syscolumns, sysconstraints, sysdefaults etc and I can't
> find this info.
> dbschema, dbaccess all know about columns that are "not null" so this info
> must be stored somewhere ..
> TIA
>
> ------=_Part_172820_19001579.1153768104017
> Content-Type: text/html; charset=ISO-8859-1
> X-Google-AttachSize: 343
>
> <div>Does anyone know where I can find if a column can contain nulls in the system tables.</div>
> <div>I've searched in syscolumns, sysconstraints, sysdefaults etc and I can't find this info.</div>
> <div>dbschema, dbaccess all know about columns that are "not null" so this info must be stored somewhere ..</div>
> <div>TIA</div>
>
> ------=_Part_172820_19001579.1153768104017--
Related threads
- Conversion to differeent characters sets
- Problem in changing locale via dbexport/dbimport
- RE: openlink error "Unable to load locale categories"