Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 6 of 6 total
Thread How i can reset the generated value ?
Wed, Apr 13 2011 10:50 AMPermanent Link

Mauro Botta

Hi

EDB ..last... Delphi last....


i have in a table a ID Field GENERATED

COLUMN "ID" INTEGER GENERATED BY DEFAULT AS IDENTITY (START WITH 1,
INCREMENT BY 1) NOT NULL

add 100 records, i have ID value from 1 to 100,

when i make a DELETE FROM MyTable , ( zap table )
this value is not reseted, if i add a record ID value is 101 , but i want 1.

How i can reset the generated value ( saved in internal structure of table )
?

now.. i delete fisical file... but i'm looking a query mode Smile
Wed, Apr 13 2011 11:27 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Mauro


From an earlier post by Uli Becker in the sql newsgroup

Have a look here:

http://tinyurl.com/2v3m788


Roy Lambert [Team Elevate]
Wed, Apr 13 2011 11:29 AMPermanent Link

Fernando Dias

Team Elevate Team Elevate

Mauro,


ALTER TABLE "MyTable" ALTER COLUMN ID RESTART WITH 0


--
Fernando Dias
[Team Elevate]
Wed, Apr 13 2011 12:13 PMPermanent Link

Mauro Botta

Tnx at all.


> ALTER TABLE "MyTable" ALTER COLUMN ID RESTART WITH 0

is there a method without EXCLUSIVE access ?
Wed, Apr 13 2011 1:49 PMPermanent Link

Fernando Dias

Team Elevate Team Elevate

Mauro,

Not that I am aware of, and it wouldn't be safe to do such a change and not having the table locked.

--
Fernando Dias
[Team Elevate]
Tue, Apr 19 2011 5:57 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Mauro,

<< when i make a DELETE FROM MyTable , ( zap table ) >>

If you're always deleting all of the rows from the table, then the EMPTY
TABLE statement will both delete all of the rows and reset all IDENTITY
columns back to 0:

http://www.elevatesoft.com/manual?action=viewtopic&id=edb2sql&topic=EMPTY_TABLE

--
Tim Young
Elevate Software
www.elevatesoft.com
Image