Re: Resetting of serial number f
Posted in 1997
Yes, there is a way.
Assume you have the following table:
create table tab1 (col1 serial);
To reset serial values to 1, execute the following sql:
insert into tab1 values (2147483646);
insert into tab1 values (0);
delete from tab1 where col1 > 2147483645 ( gets rid of junk rows )
Your next insert will have a serial value of 1.
Mike Ballentine
--------------------------( Forwarded letter 1 follows )---------------------
Date: Sunday, 4 May 1997 0:54am
From: mikey@segel.NOSPAM-.KING.OF.MYDOMAIN.-NOSPAM.com
Subject: Re: Resetting of serial number field
Date:Sat, 3 May 1997 09:14:36 -0500
Reply-To: Mike Segel <mikey@segel.NOSPAM-.KING.OF.MYDOMAIN.-NOSPAM.com>
Organization: Home for the retired Caffiene Junkie Hackers
Sender: informix-list-owner@rmy.emory.edu
To: informix-list@rmy.emory.edu
X-Informix-List-Id: <news.37497>
Sekhar Bhami contra wrote:
>
> Hi,
>
> How do I reset the "serial number" field in a table? For eg. table X
> has a serial field. If I add 10 records and delete all of them,
> then the next record has the serial number of 11. How do I reset this
> number to 1? Note that If I drop the table, the serial number starts
> from 1.
You can't.
I posted about a year ago how the serial field worked with
SE, Online is pretty much the same.
The logic is this:
LET S = serial counter.
LET F = serial field in.
LET T = Table
IF (F) == 0 THEN
T(F) = S++;
ELSE
IF F > S THEN S==F;
T(F) == F;
END IF
I realize that this is simplistic but it is the best I can do
on short notice.
When you recreate the table, the serial field is initialized to 1
HTH
-Mike
--
#include <std_disclaimer.h> /* Mike Segel (MS385) */
#include <No_Spam.h>
#ifdef OFFENDED_BY_CONTENT
The author takes no responsibility for this post.
Any resemblence to a coherent rational thought is purely coincidence.
-The Management.
#endif
*****************************
Due to AGIS's Refusal to Act Responsibly
We are blocking all of their domains at the packet level.
This block will exist until AGIS modifies their policies to
conform to existing RFCs and net community standards.
We encourage all ISPs and domain holders to do the same.
*****************************