dbTalk Databases Forums  

How to reset an autoincrement field value?

sybase.public.sqlanywhere.ultralite sybase.public.sqlanywhere.ultralite


Discuss How to reset an autoincrement field value? in the sybase.public.sqlanywhere.ultralite forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Priyesh
 
Posts: n/a

Default How to reset an autoincrement field value? - 02-13-2008 , 12:40 PM






Ultralite 10.0.1.3579

I have a temporary table which has an autoincrement field. When i insert,
say 100 records, to the table, the autoincrement climbs to 100. Now after i
use the temp table, i need to clear it out and it will be nice if i could
somehow rewind the autoincrement back to start from 1. Is there a way to do
this?

I can drop the table and recreate it to get the autoincrement ids to rewind,
but i am guessing it would be better performance wise to touch a system
table and reset it.

TIA
Priyesh



Reply With Quote
  #2  
Old   
Nick Elson
 
Posts: n/a

Default Re: How to reset an autoincrement field value? - 02-13-2008 , 03:27 PM






The "Truncate Table" statement is supposed to do that as a side-effect.

But strictly speaking, UL does not support temporary tables, so
I assume you are creating a permanent one and dropping it as
you need it.


"Priyesh" <priyesh_do_not_reply> wrote

Quote:
Ultralite 10.0.1.3579

I have a temporary table which has an autoincrement field. When i insert,
say 100 records, to the table, the autoincrement climbs to 100. Now after
i use the temp table, i need to clear it out and it will be nice if i
could somehow rewind the autoincrement back to start from 1. Is there a
way to do this?

I can drop the table and recreate it to get the autoincrement ids to
rewind, but i am guessing it would be better performance wise to touch a
system table and reset it.

TIA
Priyesh




Reply With Quote
  #3  
Old   
Nick Elson
 
Posts: n/a

Default Re: How to reset an autoincrement field value? - 02-13-2008 , 03:27 PM



The "Truncate Table" statement is supposed to do that as a side-effect.

But strictly speaking, UL does not support temporary tables, so
I assume you are creating a permanent one and dropping it as
you need it.


"Priyesh" <priyesh_do_not_reply> wrote

Quote:
Ultralite 10.0.1.3579

I have a temporary table which has an autoincrement field. When i insert,
say 100 records, to the table, the autoincrement climbs to 100. Now after
i use the temp table, i need to clear it out and it will be nice if i
could somehow rewind the autoincrement back to start from 1. Is there a
way to do this?

I can drop the table and recreate it to get the autoincrement ids to
rewind, but i am guessing it would be better performance wise to touch a
system table and reset it.

TIA
Priyesh




Reply With Quote
  #4  
Old   
Nick Elson
 
Posts: n/a

Default Re: How to reset an autoincrement field value? - 02-13-2008 , 03:27 PM



The "Truncate Table" statement is supposed to do that as a side-effect.

But strictly speaking, UL does not support temporary tables, so
I assume you are creating a permanent one and dropping it as
you need it.


"Priyesh" <priyesh_do_not_reply> wrote

Quote:
Ultralite 10.0.1.3579

I have a temporary table which has an autoincrement field. When i insert,
say 100 records, to the table, the autoincrement climbs to 100. Now after
i use the temp table, i need to clear it out and it will be nice if i
could somehow rewind the autoincrement back to start from 1. Is there a
way to do this?

I can drop the table and recreate it to get the autoincrement ids to
rewind, but i am guessing it would be better performance wise to touch a
system table and reset it.

TIA
Priyesh




Reply With Quote
  #5  
Old   
Nick Elson
 
Posts: n/a

Default Re: How to reset an autoincrement field value? - 02-13-2008 , 03:27 PM



The "Truncate Table" statement is supposed to do that as a side-effect.

But strictly speaking, UL does not support temporary tables, so
I assume you are creating a permanent one and dropping it as
you need it.


"Priyesh" <priyesh_do_not_reply> wrote

Quote:
Ultralite 10.0.1.3579

I have a temporary table which has an autoincrement field. When i insert,
say 100 records, to the table, the autoincrement climbs to 100. Now after
i use the temp table, i need to clear it out and it will be nice if i
could somehow rewind the autoincrement back to start from 1. Is there a
way to do this?

I can drop the table and recreate it to get the autoincrement ids to
rewind, but i am guessing it would be better performance wise to touch a
system table and reset it.

TIA
Priyesh




Reply With Quote
  #6  
Old   
Nick Elson
 
Posts: n/a

Default Re: How to reset an autoincrement field value? - 02-13-2008 , 03:27 PM



The "Truncate Table" statement is supposed to do that as a side-effect.

But strictly speaking, UL does not support temporary tables, so
I assume you are creating a permanent one and dropping it as
you need it.


"Priyesh" <priyesh_do_not_reply> wrote

Quote:
Ultralite 10.0.1.3579

I have a temporary table which has an autoincrement field. When i insert,
say 100 records, to the table, the autoincrement climbs to 100. Now after
i use the temp table, i need to clear it out and it will be nice if i
could somehow rewind the autoincrement back to start from 1. Is there a
way to do this?

I can drop the table and recreate it to get the autoincrement ids to
rewind, but i am guessing it would be better performance wise to touch a
system table and reset it.

TIA
Priyesh




Reply With Quote
  #7  
Old   
Nick Elson
 
Posts: n/a

Default Re: How to reset an autoincrement field value? - 02-13-2008 , 03:27 PM



The "Truncate Table" statement is supposed to do that as a side-effect.

But strictly speaking, UL does not support temporary tables, so
I assume you are creating a permanent one and dropping it as
you need it.


"Priyesh" <priyesh_do_not_reply> wrote

Quote:
Ultralite 10.0.1.3579

I have a temporary table which has an autoincrement field. When i insert,
say 100 records, to the table, the autoincrement climbs to 100. Now after
i use the temp table, i need to clear it out and it will be nice if i
could somehow rewind the autoincrement back to start from 1. Is there a
way to do this?

I can drop the table and recreate it to get the autoincrement ids to
rewind, but i am guessing it would be better performance wise to touch a
system table and reset it.

TIA
Priyesh




Reply With Quote
  #8  
Old   
Nick Elson
 
Posts: n/a

Default Re: How to reset an autoincrement field value? - 02-13-2008 , 03:27 PM



The "Truncate Table" statement is supposed to do that as a side-effect.

But strictly speaking, UL does not support temporary tables, so
I assume you are creating a permanent one and dropping it as
you need it.


"Priyesh" <priyesh_do_not_reply> wrote

Quote:
Ultralite 10.0.1.3579

I have a temporary table which has an autoincrement field. When i insert,
say 100 records, to the table, the autoincrement climbs to 100. Now after
i use the temp table, i need to clear it out and it will be nice if i
could somehow rewind the autoincrement back to start from 1. Is there a
way to do this?

I can drop the table and recreate it to get the autoincrement ids to
rewind, but i am guessing it would be better performance wise to touch a
system table and reset it.

TIA
Priyesh




Reply With Quote
  #9  
Old   
Nick Elson
 
Posts: n/a

Default Re: How to reset an autoincrement field value? - 02-13-2008 , 03:27 PM



The "Truncate Table" statement is supposed to do that as a side-effect.

But strictly speaking, UL does not support temporary tables, so
I assume you are creating a permanent one and dropping it as
you need it.


"Priyesh" <priyesh_do_not_reply> wrote

Quote:
Ultralite 10.0.1.3579

I have a temporary table which has an autoincrement field. When i insert,
say 100 records, to the table, the autoincrement climbs to 100. Now after
i use the temp table, i need to clear it out and it will be nice if i
could somehow rewind the autoincrement back to start from 1. Is there a
way to do this?

I can drop the table and recreate it to get the autoincrement ids to
rewind, but i am guessing it would be better performance wise to touch a
system table and reset it.

TIA
Priyesh




Reply With Quote
  #10  
Old   
Nick Elson
 
Posts: n/a

Default Re: How to reset an autoincrement field value? - 02-13-2008 , 03:27 PM



The "Truncate Table" statement is supposed to do that as a side-effect.

But strictly speaking, UL does not support temporary tables, so
I assume you are creating a permanent one and dropping it as
you need it.


"Priyesh" <priyesh_do_not_reply> wrote

Quote:
Ultralite 10.0.1.3579

I have a temporary table which has an autoincrement field. When i insert,
say 100 records, to the table, the autoincrement climbs to 100. Now after
i use the temp table, i need to clear it out and it will be nice if i
could somehow rewind the autoincrement back to start from 1. Is there a
way to do this?

I can drop the table and recreate it to get the autoincrement ids to
rewind, but i am guessing it would be better performance wise to touch a
system table and reset it.

TIA
Priyesh




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.