Reputation: 477
I have an app out on the Android market that user data is stored in SQLite. I created a database table with a column of ints. I would like to store floats there now. How can I do this? When I try to insert a float, my app seems to throw an exception.
Upvotes: 2
Views: 1220
Reputation: 20961
As SQlite doesn't implement full support for ALTER TABLE
(only renaming a table and adding a column), you'll have to:
INSERT INTO tmp SELECT * FROM orig
Upvotes: 3
Reputation:
Unfortunately, SQLite does not support the use of alter table
to change the datatype of a column. So, the only solution that I know of is to create a new table (with the particular column not specified as an int
datatype), fill in the new table, drop the old table, and then rename the new table (via the alter table
command) to the same name as the old table.
Upvotes: 2