In article <6aj2md$5b7@cssun.mathcs.emory.edu>, sujata_soman_at_omm-
la2-infotech-001@internet.omm.com writes
>
>Hi all,
> Some questions on how Informix handles the "Serial(n)" data type.
>
>1. How is the "next serial number" calculated ? why do I sometimes see different
>behaviour(s), for eg, if we have 5 rows, numbered 1 thru 5, and I delete #5, and
>insert a new row :- On some occasions, the new serial number is #5, and on
>others, it is #6 - Why ?
>
I is NOT documented what the next number will be only that it will be
unique. Normally I expect it to go up by one each time.
>2. I once deleted all the rows in a table with a serial number field, and when I
>tried to insert new rows, the serial number had not been updated to 0, ie the
>new numbers picked up from the old set.
>
Correct, Informix just adds one to the last number used.
>3. Now, when you create a new table with a serial type column, if you do not
>specify an initial number ( for eg serial(2) vs serial ), does that default to
>0 ??
Default starting value is 1. Inserting 0 means use the next number.
>
>4. Are the "holes" in a serial type column ever filled/re-used ??
>
If serial gets too large (2 to the power 32) it will wrap again to 1.
If 1 is used the you get an error. (This was confirmed by someone a
while back - John L(?)). If after it wraps 1 works I would expect the
same behaviour for 2 i.e. it is used if it is not already in use
otherwise you get an error..smae for 3,4,5 etc..
>TIA
>
>Sujata
>
>*****************************************
> Sujata Soman
>
>
> E-Mail: ssoman@omm.com
>
> O'Melveny & Myers, Los Angeles
>
>******************************************
>
>
>
>
>
>
>
>
>
--
David Williams
Maintainer of the Informix FAQ
Primary site (Beta Version) http://www.smooth1.demon.co.uk
Official site http://www.iiug.org/techinfo/faq/faq_top.html
I see you standin', Standin' on your own, It's such a lonely place for you, For
you to be If you need a shoulder, Or if you need a friend, I'll be here
standing, Until the bitter end...
So don't chastise me Or think I, I mean you harm...
All I ever wanted Was for you To know that I care