Theres a CFQUERY return variable called COLUMN_LIST so you could do...

<CFQUERY NAME="myQry">
    SELECT [top 1] *
    FROM [your table]
</CFQUERY>

<CFLOCK>
    <CFSET APPLICATION.fieldList = myQry.COLUMN_LIST>
</CFLOCK>


Also you could fetch the column names from the System Tables of your DB
(Sysobjects in SQL server) but that will require more work..
Remember that myQry.COLUMN_LIST returns the column list sorted
alphabetically and in uppercase...

Marc Campeau
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
Behalf Of Nolan J. Dubeau
Sent: Wednesday, January 30, 2002 11:21 AM
To: [EMAIL PROTECTED]
Subject: [CFTALKTor] SQL - Returning Column Names



Hi All,

This is part question, and part thank you.  First off, thanks to everyone
last week for the tips on activating the SQL server db.  I eventually got it
to verify after setting up the ODBC source with the proper username,
password permissions.

Second. Q:  (this may be basic to most)

I'm looking to run a query in my application.cfm file which will return the
column names of a particular table in the db.
I then want to return the column name results as a comma separated list, and
set is as an application variable.  The var will then replace the fieldlist
below:


<CFCASE value="newListing">
<cfmodule template="display/dsp_listingForm.cfm" action="BLANK"
fieldlist="MLS,SectorCode,PropertyType,Bedrooms,Name,Address1,Address2,City,
ProvinceState,PostalCode,Country,Description,Price,Image,VR,Map,Sold"></CFCA
SE>


So, my question is.. How do I write my SQL command to list only the column
names?

Many Thanks.

Nolan


Nolan J. Dubeau
Senior Developer (*.Maracca)
Interactive.Print.Broadcast Design

p. 416 532 8852
www.maracca.com


-
You are subscribed to the CFUGToronto CFTALK ListSRV.
This message has been posted by: "Marc Campeau" <[EMAIL PROTECTED]>
To Unsubscribe, Please Visit and Login to http://www.CFUGToronto.org/
Manager: Kevin Towes ([EMAIL PROTECTED]) http://www.CFUGToronto.org/
This System has been donated by Infopreneur, Inc.
(http://www.infopreneur.net)

Reply via email to