Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 7 of 7 total
Thread Reset the Autoinc field?
Fri, Aug 2 2019 6:47 PMPermanent Link

Ian Branch

Avatar

Hi Team,
I need to empty a Jobtickets table and reset the autoinc field, 'JobNo' back to 0 so the first record added is 1.
I have looked at the few 'examples' in the forums but am still not sure what to code in SQL.
Pls advise.

Regards & TIA,
Ian
Fri, Aug 2 2019 9:02 PMPermanent Link

Terry Swiers

Fri, Aug 2 2019 9:11 PMPermanent Link

Ian Branch

Avatar

Hi Terry,
Ahhh. Tks, I didn't read down far enough-(

>> ALTER COLUMN MyIdentityColumn RESTART WITH <NewSeedValue>

<NewSeedValue>?  If I set that to 1, does that mean the next (first) record added will be # 1?

Ian
Sat, Aug 3 2019 9:46 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Ian


><NewSeedValue>? If I set that to 1, does that mean the next (first) record added will be # 1?

WIthout actually trying it the last paragraph

<<This statement will properly reset the seed value for the IDENTITY column so that any newly-inserted rows will use the new seed value.>>

makes me think so

Toy
Mon, Aug 5 2019 3:20 PMPermanent Link

Terry Swiers


><NewSeedValue>? If I set that to 1, does that mean the next (first) record added will be # 1?

If you set the SeedValue to 1, the next generated number will be 2.

Terry
Tue, Aug 6 2019 2:42 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Terry


You are right. I should have looked at how Tim has set it up in the create table dialog Frown

Roy Lambert
Sat, Aug 24 2019 7:40 PMPermanent Link

Michael Riley

ZilchWorks

Avatar

>Hi Team,
>I need to empty a Jobtickets table and reset the autoinc field, 'JobNo' back to 0 so the first record added is 1.
>I have looked at the few 'examples' in the forums but am still not sure what to code in SQL.
>Pls advise.

I believe EMPTY TABLE <TableName> will so what you are looking for.

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

Michael Riley
GySgt USMC (Retired)
www.zilchworks.com
Image