You are here: irt.org | FAQ | ColdFusion | Q3005 [ previous next ]
After executing any CFQUERY statement, you can refer to the ColumnList property of the query to return a comma-delimited list of fields in the query. So, assuming we have the following query:
<cfquery datasource="myDatasource" name="myQuery"> SELECT * FROM myTable </cfquery> |
we could then use the following statement to display a list of the query fields.
<cfoutput>#myQuery.columnlist#</cfoutput> |
Note: The comma-delimited field list does not appear to be in any specific order. If you need a sorted list, you will have to sort the list of items yourself.
Feedback on 'Q3005 How do I get a list of fieldnames returned in a query?'