On Fri, 27 Feb 2009 16:25:28 +0300, Alexey Pechnikov <pechni...@mobigroup.ru> wrote:
>Hello! > >I did try > >$ sqlite3 :memory: >SQLite version 3.6.11 >Enter ".help" for instructions >Enter SQL statements terminated with a ";" >sqlite> attach database 'merch.db' as work; >sqlite> create view test as select * from work.users; >SQL error: view test cannot reference objects in database work A view or trigger in one database is not allowed to reference tables (or other views) in other databases. The reason is, the schema of the main database (in this case your :memory: database) would be invalid once the main database is opened without the attached database, or after detaching it. This should work though: sqlite> create view work.test as select * from work.users; Also, you can SELECT .... JOIN across databases, but you can't store that as a view in any of the databases. Remember, a view isn't much more than a stored select statement, so it's not as bad as it seems. >But it's work some time ago! >How can I create view for attached databases now? You can't, but you can create it in the attached database. >Create table is bad becouse attached database may be huge. You can select directly: select * from work.users; >Best regards. -- ( Kees Nuyt ) c[_] _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users