Mike D
Mike D

Reputation: 4946

Copying database schema from SQL Server 2008 to SQLite

I am trying to replicate a portion of an SQL Server 2008 database in an Android application.

Is there anyway to import into SQLite directly from a script generated by SQL Server?

I have a come across one conversion tool, which is Windows only (doesn't help me), and there is no mention of how get the result onto the Android device.

Upvotes: 1

Views: 2091

Answers (2)

user226555
user226555

Reputation:

I have no experience with SQLite, but I have had a certain amount of success migrating data from MS SQL Server to other DBs by using .NET's DataSet.WriteXml to create an xml representation of the data which can then be imported. Takes only a few lines of code.

If you have the tools to develop in the Windows environment at all, I believe you can also connect directly to SQLite with .net, so that you could directly create your SQLite DB on that platform, then just move the DB file.

Upvotes: 1

p.campbell
p.campbell

Reputation: 100657

Use the SQL Server Management Studio command "Generate Scripts". You choose the tables, and potentially include the data in the table. It will build the CREATE statements, along with the INSERT statements, if you choose. You may have to modify your column datatypes to fit SQLite.

Use any SQLite front-end as you like to execute those scripts into your Android SQLite file.

Upvotes: 1

Related Questions