How to use a Sqlserver script to create a database in Sqlite?

Asked

Viewed 238 times

2

I have a generated script from SQL Server it contains multiple tables and views, I plan to carry this database to my Android Sqlite.

How do I run the script on Sqlite on Android ?

  • 2

    You have to be more specific in the difficulty you have. Anyway you can say that it is possible that the script(SQL) is not compatible with Sqlite,

  • There is a way to transport my database (SQL) to an internal Android database?

  • Face of a googled...

  • You know how to create a database in Sqlite via Sqliteopenhelper?

  • Yes, I can create.

1 answer

3

Follow the following steps:

  • On the side of the Sqlserver manages the script rearing.

  • Change the script in order to be compatible with Sqlite.

  • Derive from Sqliteopenhelper and use the script the same way it does when it creates any other bank, using db.execSQL().

Note: db.execSQL() only executes one SQL command at a time. You have to retrieve each of the existing SQL commands in script and run them one by one, something like that:

StringTokenizer tokenizer = new StringTokenizer( script, ";", false);

while (tokenizer.hasMoreTokens())
{
    db.execSQL(tokenizer.nextToken());
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.