Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Q3005 How do I get a list of fieldnames returned in a query?

irt.org | Knowledge Base | ColdFusion | Q3005 [ previous next ]

Q3005 How do I get a list of fieldnames returned in a query?

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?'


Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.