On 2014-04-03, 11:08 PM, Scott Robison wrote:
I would think this would make an excellent virtual table extension.
On Apr 3, 2014 11:03 PM, "Darren Duncan" <dar...@darrenduncan.net> wrote:

On 2014-04-03, 7:19 PM, Andy Goth wrote:

I don't believe this can be done in pure SQL since table names are not
values.  That doesn't mean it can't be done, though you will have to put
some of the logic in your program itself.


I expect that in the future this limitation will no longer exist.  There's
no reason that table names can't be values in principle. -- Darren Duncan

So here's a thing. For any SQL DBMSs that support the "information schema", table names and the like are already represented as values in tables, so whatever data type is used there, allowing it for user-defined tables is a first step to what you want.

Putting that aside, for any SQL DBMS that supports the PREPARE and EXECUTE keywords, you can have a SQL string value that contains a SQL statement and execute it, and you can build that string in other SQL from your table like with any string manipulation. This is a standard way to do it, if not the most elegant, it is simple and powerful.

-- Darren Duncan

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to