Nerdrium Home

Macintosh

Linux

Web Design

Case Mods

Gardening

Photography

Recipes

 

My Blog

 

Facebook

Twitter

Find Column Titles With ColdFusion

by Michael Greifenkamp (April 21st, 2010)

I needed to find out the column titles of a SQL database, and without direct access to the DB itself, found that I could do it indirectly using a ColdFusion page.

It's pretty simple, really.

<cfQuery datasource="mydatasource" name="myCoolQuery">
SELECT * FROM tablename
</cfQuery>
<cfOutput>#myCoolQuery.ColumnList#>

That will output, for example, something like ID,FIRSTNAME,LASTNAME,LOCATION, etc.

Good luck!

--Michael