Viewing SQL columns and values with only the tablename as reference
Let's assume we only know the name of the table and we want to know the column names and there values of every record. The following example is a way to quickly get an insight of the table and it's data.
<cfquery datasource="#application.dsn#" name="qRecordset" blockfactor="100">
SELECT *
FROM yourtable
</cfquery>
<cfoutput>
<!--- Vertical loop --->
<cfloop from="1" to="#qRecordset.recordcount#" index="i">
<!--- Horizontal loop without knowing the columns in your table --->
<cfloop list="#qRecordset.columnlist#" index="column">
#column# = #qRecordSet[column][i]#<br />
</cfloop>
<hr />
</cfloop>
</cfoutput>
4883 viewed | Your opinion... | del.icio.us | Digg it | Tjarko @ 14/06/04 0:00 cet



