Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2005
    Posts
    74

    Question Unanswered: Dynamic generation of table name

    I have a database that has some of its tables created at run-time, i.e., a table name is computed by a program and then the table is created, and the data - written to it. My program will have no trouble finding those tables but the end users will want to run queries using a DBMS client of their choice. They may simply want us to write them some predefined queries that they can execute in MSQuery to build Excel spreadsheets, or something like that.
    My question is: is it possible to put in the FROM clause of a SELECT statement anything other than a string describing the name of a table in the database, and more specifically, a sub-query? Let's say I have a table with a known name that contains two columns, and I want to use the concatenation of the contents of those two columns to build the names of some tables, which will then be used in the FROM clause of another SELECT statement. Is that possible and how can I do that? Thanks in advance!
    Kamen

  2. #2
    Join Date
    Jun 2003
    Location
    West Palm Beach, FL
    Posts
    2,713

    Cool


    For end-users: NO, for Developers you can use dynamic SQL.
    Maybe for the end-users you could create a synonym for these tables, for example: every time you create a new table, you could drop old synonym and create new pointing to new table.

    The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

  3. #3
    Join Date
    Dec 2005
    Posts
    74
    Bummer... That's what I thought, looking at the SQL documentation. I guess they can always use some "programmable" client, such as MS Access. Thanks, anyway.
    Kamen

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •