Re: SERIAL seed value
Posted in 1996
The starting value for a SERIAL column is not stored anywhere in the Informix database -- not even in the hidden tables or the SysMaster database or the TblSpace TblSpace information. Although you can use SELECT MIN(SerialColumn) to get an estimate of the seed value, this can be erroneous either because a value lower than the seed value was inserted manually (eg a negative value), or because the row with the seed value has been deleted. The seed value information is simply not available except from the CREATE TABLE statement used to build the table. That's why ISQL and DB-Access and DB-Export and DB-Schema do not manage to give a seed value when they describe a table with a serial column -- the information is not available. Yours, Jonathan Leffler (johnl@informix.com) #include <disclaimer.h> }From: "Sandy Spiers" <sandys@easter.euro.csg.mot.com> }Date: Tue, 21 May 1996 09:24:17 +0100 }Subject: Re: SERIAL seed value }X-Informix-List-Id: <list.9928> } }On May 20, 11:38am, Nigel C. Myers wrote: }> Subject: Re: SERIAL seed value }> Actually, what I am looking for is a way to retrieve the starting number }> for values in a SERIAL column. For example, if a column was defined as }> SERIAL(1001), how can I get the '1001' value? }> }>-- End of excerpt from Nigel C. Myers } }Nigel, } }My apologies Nigel, I misunderstood your post. Its not an ideal solution but }if you are needing to know the initial "seed value" then the following select }would return both the inital value and the last value used... } }select min(column_name), max(column_name) from table_name } }I do percieve one problem here however. If data is removed from the table in }question and perhaps transferred out into an archive table/database then you }would lose the "initial seed" value by using a select. I *don't know* if its }stored in the systables but someone from Informix may be able to confirm }this. } }sandys