In CF8 there is cfdbinfo This function below will return a query object the following fields (see below). http://www.cfquickdocs.com/cf8/?getDoc=cfdbinfo#cfdbinfo
If you don't have CF 8 you will have to query the metadata based on the SQL dialect for that particular database. You can look at the source code for Brian Rinaldi's Illudium cfcgenerator. Last time I looked he had cfcs for MySQL, MSSQL, Oracle and Postges. http://code.google.com/p/cfcgenerator/ <cffunction name="GetTableMetaData" access="public" output="false" returntype="query" hint="I return column metadata"> <cfargument name="MyDSN" required="true" type="string" /> <cfargument name="MyTable" required="true" type="string" /> <cfdbinfo type="columns" datasource="#arguments.MyDSN#" name="TableMetaData" table = "#Arguments.MyTable#" > <cfreturn TableMetaData /> </cffunction> COLUMN_NAME Name of the column. TYPE_NAME SQL data type of the column. IS_NULLABLE Whether the column allows nulls. IS_PRIMARYKEY Whether the column is a primary key. IS_FOREIGNKEY Whether the column is a foreign key. REFERENCED_PRIMARYKEY If the column is a foreign key, the name of the table it refers to. REFERENCED_PRIMARYKEY_TABLE If the column is a foreign key, the key name it refers to. COLUMN_SIZE Size of the column DECIMAL_DIGITS Number of digits to the right of the decimal point. COLUMN_DEFAULT_VALUE Default value of column. CHAR_OCTET_LENGTH Maximum length in bytes of a character or integer data type column. ORDINAL_POSITION Ordinal position of the column. REMARKS Remarks of the column. On Fri, Feb 26, 2010 at 12:13 PM, Joshua Rowe <[email protected]>wrote: > > Hello. Is there a way to return a datatype list from your query along with > the column list? Example: > > <cfquery name="qryTest" datasource="test"> > SELECT * FROM tblTest; > </cfquery> > > <cfoutput> > #qryTest.columnlist#<br> > #qryTest.datatypes# > </cfoutput> > > Thanks! > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:331193 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

