Exporting from SQLite to SQL Server

I know that this is old thread, but I think that this solution should be also here.

  • Install ODBC driver for SQLite
  • Run odbcad32 for x64 or C:\Windows\SysWOW64\odbcad32.exe for x86
  • Create SYSTEM DSN, where you select SQLite3 ODBC Driver
  • Then you fill up form where Database Name is filepath to sqlite database

Then in SQL Server run under sysadmin

USE [master]
GO
EXEC sp_addlinkedserver 
   @server     = 'OldSQLite', -- connection name
   @srvproduct = '',          -- Can be blank but not NULL
   @provider   = 'MSDASQL', 
   @datasrc    = 'SQLiteDNSName' -- name of the system DSN connection 
GO

Then you can run your queries as normal user e.g.

SELECT * INTO SQLServerDATA FROM openquery(SQLiteDNSName, 'select * from SQLiteData')

or you can use something like this for larger tables.


SQLite does have a .dump option to run at the command line. Though I prefer to use the SQLite Database Browser application for managing SQLite databases. You can export the structure and contents to a .sql file that can be read by just about anything. File > Export > Database to SQL file.


sqlite-manager, firefox add-on: allows you to export an SQLite database in a SQL script.

Data Base>Export Database>Export to file

(Correction firefox 35 bugg obliged to correct the extension code as indicate to the following web page: How to fix your optional sqlite manager module to work)

Command line :

sqlite3 DB_name .dump > DB_name.sql

exports the sqlite database in a SQL script.

From url : http://doc.ubuntu-fr.org/sqlite.


The SQLite .dump command will output the entire contents of the database as an ASCII text file. This file is in standard SQL format, so it can be imported into any SQL database. More details on this page: sqlite3