views:

47

answers:

1

Is there a SELECT command that can list all attached databases similar to the .database command available in sqlite3?

+3  A: 

You cannot do this with a SELECT statement that I know of (though you might want to look around in the main database, this data might be stored there). However, there is a solution. If you execute the following statement it will return the databases attached for the current connection:

PRAGMA database_list;

The first row will always be the main database, the second will always be the temp database. Any further databases are after these first two. You can run this statement against your database the same way you would a SELECT statement from your code in c# (or anything else for that matter).

Here is a good reference:

SQLite PRAGMA statement reference

Good luck!

Tim C
This worked perfectly. Thanks!
galford13x