Can I make a field AUTOINCREMENT after made a table? For example, if you create a table like this:
create table person(id integer primary key, n
While the Sqlite site gives you an example how to do it with a table with only a three fields, it gets nasty with one of 30 fields. Given you have a table called OldTable with many fields, the first of which is "ID" filled with integers. Make a copy of your database for backup. Using the command program dot commands,
.output Oldtable.txt
.dump Oldtable
Drop Table Oldtable;
Open Oldtable.txt in Microsoft Word or a grep like text editor. Find and Replace your Integer field elements with NULL.(You may need to adjust this to fit your fields). Edit the Create Table line so the field that was defined as Integer is now INTEGER PRIMARY KEY AUTOINCREMENT. Save as NewTable.txt
Back in the command program dot
.read NewTable.txt
Done. ID is now autoincrement.