I have a SQL Server generated script it contains several tables and views, I intend to carry this database to my Android SQLite.
How do I run the script in SQLite on Android?
I have a SQL Server generated script it contains several tables and views, I intend to carry this database to my Android SQLite.
How do I run the script in SQLite on Android?
Follow the steps below:
On the side of SQLServer manages the creation script.
Change the script to be compatible with SQLite.
Derive from SQLiteOpenHelper and use the script in the same way it does when you create any other database, using db.execSQL()
.
Note: db.execSQL()
only executes one SQL statement at a time. You'll get each of the existing SQL commands in the script and run them one by one, something like this:
StringTokenizer tokenizer = new StringTokenizer( script, ";", false);
while (tokenizer.hasMoreTokens())
{
db.execSQL(tokenizer.nextToken());
}