Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Resetting the value for the serial data type

Status
Not open for further replies.

testhandle

Technical User
Mar 14, 2003
42
0
0
GB
Hi,

Informix online 5.0 serial data type has a limitation of max value 2,147,483,647. Is there any way to reset the value to 1 after reaching the max?

Thanks
John Jayaseelan
 
Take a look at the ALTER TABLE ... MODIFY clause.

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Is there any other way to implement this (For example in the create table syntax itself).
 
In the create table, use SERIAL(n), with n as the starting number.

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
The table is created using 'SERIAL', how the value of serial will be reset after reaching the max. Does that happen or needs to be reset.
 
Hi John Jayaseelan,

>Does that happen or needs to be reset

Well, it does automatically, no manual intervention is needed. Here is the evidence:

create temp table xtable (xcol serial(50)) with no log;
insert into xtable values (0);
insert into xtable values (0);
select * from xtable;
insert into xtable values (2147483647);
insert into xtable values (0);
insert into xtable values (0);
select * from xtable;

However, if the serial field has unique/primary constraint, the insert will fail.

Regards,
Shriyan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top