RE: Script Example
Posted in 2004
Topics: Data Types & Schema Design, Versions, Editions & End-of-Life
Jonathan Leffler wrote
I must be very brave after yesterdays correction :-)
> Carlos San Miguel wrote:
> > Can someone post an example of a table creation with an autoinc
> > primary key? The autoinc has to be a 4 byte integer. I know
> the syntax
> > for other back-ends but not for Informix.
>
> Data type SERIAL - insert zero to allocate a number (or omit the
> column from the insert statement).
create table promotion
(
promotion_id serial not null ,
promotion_ref char(8) not null ) ;>
> Alternatively, in IDS 9.40, use SEQUENCES (a la DB2 and Oracle).
>
> Also, what the equivalent
> > for the following data types? :
>
> RTF(abulous)M?
>
> > Integer(4 byte)
> INTEGER
> > SmallInt(2 byte integer)
>
>INTEGER
SMALLINT Stores a 2-byte integer value. These values can be in the range
-((2**15)-1) to (2**15)-1 (that is, from -32,767 to 32,767).
I copied this from my manual !!
> > TinyInt(1 byte Integer)
> SMALLINT CHECK(colname BETWEEN -127 AND +127)
Colin Bull
c.bull@videonetworks.com
sending to informix-list
Colin Bull wrote:
> Jonathan Leffler wrote
>>[...]
> I must be very brave after yesterdays correction :-)
There's no need to be brave when you're correct.
[I apologize for the emphatic correction (related to ontape for those
not paying close attention), but the difficulty is that in these days
of groups.google.com and IIUG, misinformation (even when
unintentional) lives on forever - and needs to be corrected when
necessary.]
>>Carlos San Miguel wrote:
>>
>>>Can someone post an example of a table creation with an autoinc
>>>primary key? The autoinc has to be a 4 byte integer. I know
>>
>>the syntax
>>
>>>for other back-ends but not for Informix.
>>
>>Data type SERIAL - insert zero to allocate a number (or omit the
>>column from the insert statement).
>
>
> create table promotion
> (
> promotion_id serial not null ,
> promotion_ref char(8) not null ) ;>
>>Alternatively, in IDS 9.40, use SEQUENCES (a la DB2 and Oracle).
>>
>> Also, what the equivalent
>>
>>>for the following data types? :
>>
>>RTF(abulous)M?
>>
>>
>>>Integer(4 byte)
>>
>> INTEGER
>>
>>>SmallInt(2 byte integer)
>>
>>
>>INTEGER
Did I really write INTEGER twice? Apologies - and you're perfectly
correct to point out that I should have said SMALLINT, which was what
I intended to say. Not enough proof-reading.
> SMALLINT Stores a 2-byte integer value. These values can be in the range
> -((2**15)-1) to (2**15)-1 (that is, from -32,767 to 32,767).
>
> I copied this from my manual !!
>
>
>>>TinyInt(1 byte Integer)
>>
>> SMALLINT CHECK(colname BETWEEN -127 AND +127)
--
Jonathan Leffler #include <disclaimer.h>
Email: jleffler@earthlink.net, jleffler@us.ibm.com
Guardian of DBD::Informix v2003.04 -- http://dbi.perl.org/