[thelist] Easy (?) Database Question

rudy r937 at interlog.com
Fri Jan 5 10:45:10 CST 2001

> is there anyway to run a loop that rattles off
> all the column names in the database?

hi jonathan

depending on the database, you can query the database system catalog tables
just like any other table and pull out table names, column names, column
datatypes, etc.

if you're using cold fusion (sorry, i dunno about other scripting
languages, but i assume they will have similar methods), there is also a
much simpler way, which i find more appealing than querying the database
tables, because  a) i love to keep things simple, and  b) it works no
matter what database you're running

run a select star query against the target table, limit the rows to one
(you're not actually after the rows), and then loop through the
comma-delimited list of column names that cf returns in the
queryname.ColumnList variable


More information about the thelist mailing list