Seen
Seen

Reputation: 4194

Bulk load tables in SQLite db files into SQL Server

I have 60 files which are in .db format, each of them has several tables. I am wondering what is the fastest way to upload some specific tables (by a certain criteria of the table name) in each .db file into the corresponding tables in my SQL Server. I have not dealt with SQLite before.

Upvotes: 2

Views: 5083

Answers (2)

Ruzbeh Irani
Ruzbeh Irani

Reputation: 2438

sqlite> .mode list
sqlite> .separator |
sqlite> .output test_file_1.txt
sqlite> select * from tbl1;

then you can use the text file and use BCP toinsert into SQL server

The SQL Server Import and Export wizard is pretty straightforward, and the resulting Integration Services package can be saved and scheduled for execution:

http://msdn.microsoft.com/en-us/library/ms141209.aspx

Or you can use the T-SQL BULK INSERT command. This requires that the text file is either on the database server filesystem or available via UNC path:

http://msdn.microsoft.com/en-us/library/ms188365.aspx

Upvotes: 1

Peter Schofield
Peter Schofield

Reputation: 993

I'd recommend using SQL Server's SSIS functionality to connect to the SQLite database through ODBC/OLEDB, and then import the tables as required.

This is easy to get started - in SQL Server Management Studio, create an empty database - and then right mouse on it, select tasks - and then import/export data. This will get you going as the GUI is easy to use.

The hardest thing might be finding a ODBC/OLEDB driver for SQLite...

Upvotes: 1

Related Questions