And for those other dbs that support it (such as MySQL)

The show command will get you this sort of info as well.

show databases
show tables from #datasource#
show columns from #table#
etc.

for more info on show (and other mysql info: http://www.mysql.com/doc/S/H/SHOW.html)

probably my favorite db command.
(Damn the man - for using those sp_s rather than show)
Jerry Johnson


>>> [EMAIL PROTECTED] 04/10/02 03:18PM >>>
Did you want the list of field names returned in your query or did you want
the columns available in the DB table?

For the query, use #myquery.columnlist#

For the DB, try this (works for SQL Server Only):

<CFSET TableName = "#tablename">
<CFSTOREDPROC PROCEDURE="sp_columns"  DATASOURCE="#datasource#">
   <CFPROCPARAM TYPE="In" CFSQLTYPE="CF_SQL_VARCHAR"
    DBVARNAME="@table_name"
    VALUE="#TableName#"
    NULL="No">
   <CFPROCRESULT NAME="First" RESULTSET="1">
</CFSTOREDPROC>

<TABLE>
<CFOUTPUT QUERY="First">
  <TR>
    <TD>#Column_Name#</TD>
    <TD>#Type_Name#</TD>
    <TD>#Length#</TD>
    <TD>#Nullable#</TD>
    <TD>#Column_def#</TD>
  </TR>
</CFOUTPUT>



Jeff 

-----Original Message-----
From: Shawn Regan [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, April 10, 2002 12:11 PM
To: CF-Community
Subject: RE: Refuting Insane Claims


I'm drawing a blank on how to get the field names from a database
dynamically. QUERY.columnames?? something like so??


Shawn Regan
Applications Developer
Pacific Technology Solutions 



______________________________________________________________________
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to