Artem
Artem

Reputation: 4639

Android SQLite how to change autoincrement primary key?

I want add new column in my table and set it column as AUTOINCREMENT PRIMARY KEY, but I already have in this table AUTOINCREMENT PRIMARY KEY.

It is possible?

Upvotes: 1

Views: 168

Answers (2)

IntelliJ Amiya
IntelliJ Amiya

Reputation: 75788

Courtesy goes to SQLite - AUTO INCREMENT

SQLite AUTOINCREMENT is a keyword used for auto incrementing a value of a field in the table. We can auto increment a field value by using AUTOINCREMENT keyword when creating a table with specific column name to auto incrementing it.

So for your requirement , you can't use again this on run time . Only One way

  1. Uninstall App & create once again .

Upvotes: 1

royB
royB

Reputation: 12977

No you can't alter columns in SQLite.

have a look at the things Sqlite does not implement

You should drop the table and create a new one and copy the data back

Upvotes: 2

Related Questions