I'm trying to query a MySQL 3.23 database to get table names that match a 
naming pattern.  Unfortunately, there doesn't seem to be any way to alias 
the column name returned, plus the name contains both a space and the 
percent sign used in my original SQL statement.  Also, the syntax of SHOW 
TABLES doesn't permit column aliasing.  The column name generated by the 
code example below ends up being

TABLES_IN_LIVESTATS (SERVER%_DEMOGRAPHICS)


<cfquery datasource="livestats" name="q">
SHOW TABLES like 'server%_demographics'
</cfquery>
<cfoutput>
Query Columns: #q.ColumnList#
<cfloop query="q">
  <cfset tblname = Evaluate("q." & q.columnList)>
  #tblname#<br>
</cfloop>
</cfoutput>


The error I receive from CF is:
---------------------------------------------------------------------
An error occurred while evaluating the expression:


 tblname = Evaluate("q." & q.columnList)


Error near line 23, column 9. An error has occurred while processing the 
expression:
   q.TABLES_IN_LIVESTATS (SERVER%_DEMOGRAPHICS)

Invalid token found on line 1 at position 30. ColdFusion was looking at 
the following text:

%Invalid expression element. The usual cause of this error is a 
misspelling in the expression text.

---------------------------------------------------------------------


Is there an alternative method for addressing query columns, say, similar 
to using array notation when addressing the rows of a query?




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:205294
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to