Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is there a way to open a .db file (sqlite database file) from within microsoft sql management studio?

Right now we have a process that will grab the data from a microsoft sql server database and put it into a sqlite database file that will be used by an application later on.

Is there a way to open the sqlite database file so that it can be compared to the data inside the sql server database ... using only one sql query?

Is there a plug-in for microsoft sql management studio? Or maybe there is another way to do this same task using only one query.

Right now we have to write two scripts ... one for sql server database and one for sqlite database ... then take the output from each in the same format and put them each in their own OpenOffice spreadsheet file. Finally, we compare the two files to see if there are any differences. Perhaps there's a better way to do this.

Edit: The table columns and layouts are different so using the combo of http://www.codeproject.com/KB/database/convsqlservertosqlite.aspx and http://www.sqlitecompare.com/ will not work here.

P.S. Alot of applications use sqlite internally: Well-Known Users Of SQLite

share|improve this question

5 Answers 5

up vote 6 down vote accepted

Hi Yes it is possible to open any sql server from within management studio when you have the correct odbc driver to do so. Create an ODBC connection to the *.db3 file and call it something like SQLite then try this is a query window

-- needs to be a system odbc connection not user

EXEC sp_addlinkedserver 
   @server = 'SQLite', -- the name you give the server in studio 
   @srvproduct = '',
   @provider = 'MSDASQL', 
   @datasrc = 'SQLite' -- the name of the system odbc connection you created
GO

This is how you get the data, you can create views using this sql as well if you like

SELECT * FROM OPENQUERY(SQLite, 'SELECT * FROM tbl_Postcode')

share|improve this answer

You may want to create a linked server, if you have a provider for SQLite that SQL Server will accept.

Connect to your database and then navigate through "Server Objects", "Linked Servers" and add a new linked server. You can then use SQL Server to query the SQLite database, and compare the results directly.

Here is a tutorial for MySQL, so if you can create an ODBC connection for SQLite then you will be good to go.

share|improve this answer

It IS possible to open another type of database in Management Studio. I opened an Informix database, using a linked server to the Informix server.

share|improve this answer

You'll need an ODBC driver for SQLite before you can set up a linked server, but once you have one of those installed on your sql server, it's relatively easy to set up a linked server using it.

Example using "SpiceWorks" SQLite database

share|improve this answer

Since SQLite is an embedded database it is not possible to open it in Management Studio. And I don't believe any database server other than SQLServer can be opened from management studio!

As a solution you can use SQLite Ado.NET Provider from here http://sqlite.phxsoftware.com/

You can write a CLR Stored procedure for your database that uses above provider to do the conversions. In the end everything should be done in one query.

share|improve this answer
    
you can open SQL compact with SSMS at the very least. –  m4tt1mus Feb 15 '12 at 6:51
    
@mattimus: We are talking about SQLite here!! not SQL Server Compact! –  Salar Khalilzadeh Mar 5 '12 at 4:51
1  
@ SalarKhalilzadeh and in your answer you said "And I don't believe any database server other than SQLServer can be opened from management studio!", you're incorrect. –  m4tt1mus Mar 6 '12 at 20:01

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.