Auto-increment
Auto-increment
I am not sure what I didd but my auto increment value went from a four digit number(i.e. 1574) to a 5 digit number(11575) Now I get an integrity constraints violation SYS_FK_67 What did I do and how can i fix it
LibreOffice 5.3 on windows 10
-
- Volunteer
- Posts: 1549
- Joined: Wed Jun 24, 2015 12:56 am
- Location: Colorado, USA
Re: Auto-increment
Always backup your database before making any changes like this.
Edit and then run the following query.
The first value returned is the maximum value for the auto-increment field. Add one to that value then edit and execute the following at Tools>SQL
Edit and then run the following query.
Code: Select all
SELECT "KeyFieldName" FROM "YourTableName" ORDER BY "KeyFieldName" DESC;
Code: Select all
ALTER TABLE "TableName" ALTER COLUMN "KeyFieldName" INTEGER GENERATED BY DEFAULT AS IDENTITY (START WITH <n>);
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11