Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

parameterizing columns and column titles

Status
Not open for further replies.

ro1016

Programmer
Mar 30, 2006
13
US
Hi everybody,

I’m doing some reports in coldfusion with sql server backend. I’m trying to create a template for displaying the reports. What I want to do is that when I write the queries in sql server count the number of fields in the select statement and use that for the number of columns and get the alias(the As statement) to use as the name of the column in coldfusion. Counting the number of fields and columns shouldn't be a big problem but has anybody ever done or has any idea of how to get the alias for column title in coldfusion?

 
You can use query_name.columnList to get list of columns returned from your query, it should use whatever aliases you assign in your query.

Example:
Code:
<cfquery name="GetName">
Select [first name] AS FirstName, [Last] AS LastName
From WhateverTable
</cfquery>

<cfoutput>#GetName.ColumnList#</cfoutput>
The above should return a list with the values "FirstName,LastName".


Hope This Helps!

ECAR
ECAR Technologies

"My work is a game, a very serious game." - M.C. Escher
 
Thank you ECAR, I'm gonna try this.

"Beyond ideas of right and wrong, there is a field. I'll meet you there." Rumi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top