Self Generating and executing SQL Select Query. RRS feed

  • Question

  • In Access 2010 what I want to create is a self generating SQL Script 'Y'.

    Script 'Y' is to gather only the records of type 'X' from Table AA

    The trick is to exclude columns from Table AA when not expecting data.

    The columns to include and exclude into Script 'Y' is contained in table CC.

    Table CC has two columns

             1) one column containing the columns name matched to the column names of Table AA

              2) the other column contains the new column Title.

    Thus if no column of Table AA matches the Column Name in Table CC those columns are excluded from the self generating Script.

    The final objective is to use this dynamic script to generate a form on the fly of records with columns where those columns are expected to have data.

    The other part of the process is to associate the selected columns of Type 'X' and re-label with the columns with the new column 'Titles' as per Table CC.

    I've seen this achieved in several propriety software but am at a loss as to how to.



    • Moved by Kalman Toth Friday, May 24, 2013 7:22 PM Not db design
    Thursday, May 16, 2013 6:44 AM

All replies

  • Not really a database design question - and apparently not really a sql server question.  You might try posting your question to the tsql forum if you are looking for tsql help - if you do, you might as well post your DDL, sample data, and what exactly you expect to achieve.  If you want a script, you will need to show an example of that script based on your sample input.
    Thursday, May 16, 2013 12:48 PM