Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 165
  • Last Modified:

How do i output my sql database field names in a <cfquery> tag?

I would like to output the field names of my sql database table. I know how to output the actual data in a table using <cfquery> and <cfoutput query=> but i want to know to display the field names themselves in a repeating table.
0
rarid122481
Asked:
rarid122481
1 Solution
 
duncancummingCommented:
<cfquery name="getData" ...>
SELECT *
FROM yourTable
</cfquery>

<cfoutput>
<cfloop index="column" list="#getData.ColumnList#">
#column#<br>
</cfloop>
</cfoutput>
0
 
azadisaryevCommented:
keep in mind, though, that #queryname.columnlist# always returns the query columns in alphabetical order, NOT in the order you use them in your SELECT clause...

Azadi
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now