Solved

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

Posted on 2009-04-04
2
161 Views
Last Modified: 2013-12-24
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
Comment
Question by:rarid122481
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 16

Accepted Solution

by:
duncancumming earned 500 total points
ID: 24068487
<cfquery name="getData" ...>
SELECT *
FROM yourTable
</cfquery>

<cfoutput>
<cfloop index="column" list="#getData.ColumnList#">
#column#<br>
</cfloop>
</cfoutput>
0
 
LVL 27

Expert Comment

by:azadisaryev
ID: 24068509
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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
Lease-to-own eliminates the expenditure of hardware replacement and allows you to pay off the server over time. Usually, this is much cheaper than leasing servers. Think of lease-to-own as credit without interest.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question