Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 2 of 2 total
Thread Insert into an autoinc field?
Sun, Dec 1 2019 9:22 PMPermanent Link

Ian Branch

Avatar

Hi Guys,
My Customer has inadvertently deleted a record with an autoinc field.
Can I insert a record to replace the missing one/autoinc field?
Regards & TIA,
Ian
Mon, Dec 2 2019 8:45 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Ian


Simple answer - NO

More complex answer - YES - change the column to

INTEGER GENERATED BY DEFAULT AS IDENTITY (START WITH 0, INCREMENT BY 1) NOT NULL!

and then it can be edited. SO you add a new record, alter the autoinc to whatever you want and then alter the start point for the column back to the one that should be next (otherwise you'll still have a gap). You have already been given the info you need to reset the seed value.



Roy Lambert

ps - ALL my autoincs are set as by default rather than always - since I generally supply no way for a typical user to edit they don't get screwed around but it goves me these sort of options
Image