CFQUERYPARAM with tables names

Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default CFQUERYPARAM with tables names

    Is there a way to create this sort of query?

    select *
    from <cfqueryparam value="table_name">


    Thank you
    Don Vaillancourt Guest

  2. Similar Questions and Discussions

    1. Accessing duplicate field names from different tables
      Hi, I am joining two tables, and the two tables have the same field names, but they represent different data. eg. table 1 - People name -...
    2. cfqueryparam and mysql
      I have a question, is cfqueryparam's cfsqltype attribute database dependent? For example, in the LiveDocs, there is no mention of mysql's mediumint...
    3. cfqueryparam
      Hi, I am trying to take values passed through a form and do a search based on that, but I am getting an error Error Executing Database Query....
    4. How to rename Access tables and field names?
      Jet SQL doesn't support any kind of rename statements directly. I figured this can probably be handled through ASP but I'm not sure how to go...
    5. Machine names v. User names
      Good Morning... Unfortunately one of our mainframe processes require a local machine name that is identical to the local user account name. For...
  3. #2

    Default Re: CFQUERYPARAM with tables names

    No. Here's what the CF docs say about the field "value": Required. Specifies
    the actual value that ColdFusion passes to the right of the comparison operator
    in a where clause.

    What are you trying to accomplish?

    jdeline Guest

  4. #3

    Default Re: CFQUERYPARAM with tables names

    No. I believe cfqueryparam uses jdbc data type specs and afaik there is not a
    "table" data type. If you just need to scrub the "table_name" string, you
    could use a simple UDF. There are some over at cflib.org or you could create
    your own.

    [url]http://livedocs.macromedia.com/coldfusion/7/htmldocs/00000317.htm[/url]

    mxstu Guest

  5. #4

    Default Re: CFQUERYPARAM with tables names

    We have an app which needs to support multiple databases. And so
    because not all database engines support auto-increament and
    auto-increament through ColdFusion is not necessarily a good idea on
    clustered environments we opted to stored the unique ids in a special
    table that has two columns, table_name and id. There is a third column
    we use for clustering, but isn't important for this example.

    So anyway, to keep the recompliation of queries to a minimum I was
    hoping to make the table_name a variable.

    The functionality is already written and so all is working. I just
    wanted to optimize the query as much as possible.

    Where the table_name comes into play as a table is if the entry in the
    unique_id table for the specified table_name is non-existant, I would
    need to get the largest ID from the table_name table.

    And because our system has almost 50 tables that require a unique PK, I
    was hoping to keep the number of compiled queries down to one.

    jdeline wrote:
    > No. Here's what the CF docs say about the field "value": Required. Specifies
    > the actual value that ColdFusion passes to the right of the comparison operator
    > in a where clause.
    >
    > What are you trying to accomplish?
    >
    Don Vaillancourt Guest

  6. #5

    Default Re: CFQUERYPARAM with tables names

    You can make the table name a variable.

    SELECT * FROM #tableName# WHERE ...

    Will that do the job for you?
    jdeline Guest

  7. #6

    Default Re: CFQUERYPARAM with tables names

    Well like I said, it's all done and we've done like you describe.

    But my goal in regards to optimization is I was hoping to make as much
    into parameters as possible. But that's alright. I'll use cfqueryparam
    where I can and simple variables when I cannot.

    Thanks


    jdeline wrote:
    > You can make the table name a variable.
    >
    > SELECT * FROM #tableName# WHERE ...
    >
    > Will that do the job for you?
    Don Vaillancourt Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139