drop database Table if exists - Android Database

Android examples for Database:Table Drop

Description

drop database Table if exists

Demo Code


//package com.book2s;
import android.database.sqlite.SQLiteDatabase;

public class Main {
    public static void dropTable(final SQLiteDatabase db, final String table) {
        final StringBuilder dropSql = new StringBuilder();
        dropSql.append("DROP TABLE IF EXISTS ").append(table).append(";");

        db.execSQL(dropSql.toString());//from  w ww . j  av  a2s  . co  m
    }
}

Related Tutorials