Sqlite. How to create an index in attached DB?

Posted by kappa on Stack Overflow See other posts from Stack Overflow or by kappa
Published on 2011-11-15T09:47:37Z Indexed on 2011/11/15 9:50 UTC
Read the original article Hit count: 246

Filed under:
|
|

I have a problem with adding index to memory database attached to main database.

1) I open the database (F) from file

2) Attach the :memory: (M) database

3) Create tables in database M

4) Copy data from F to M

I would also like to create an index in database M, but don't know how to do that. This code creates index but in F database:

sQuery = "CREATE INDEX IF NOT EXISTS [INDID] ON [PANEL]([ID]  ASC);";

I tried to add the name qualifier before table name like this:

sQuery = "CREATE INDEX IF NOT EXISTS [INDID] ON [M.PANEL]([ID]  ASC);";

but SQLite returns with message that column main.M.PANEL does not exist.

What can I do?

© Stack Overflow or respective owner

Related posts about database

Related posts about query