Beginner
Beginner

Reputation: 29553

How To delete a table

How do i delete a whole table in android through code?

Upvotes: 1

Views: 3440

Answers (2)

bgs
bgs

Reputation: 1250

You can delete a database easily by writing a test case inheriting from AndroidTestCase (You don't have to but its an option), that way you will get access to Context, and call deleteDatabase("mydatabase.db") on it.

Upvotes: 0

Nanne
Nanne

Reputation: 64409

I'd say just use a DROP TABLE query?

(I'm asuming you're talking about a database, and you're using the SQLite that's in Android, right? http://www.sqlite.org/lang_droptable.html )

an example as requested:

 DROP TABLE IF EXISTS mydatabase.myTable

Upvotes: 1

Related Questions