[thelist] Easy (?) Database Question

Jonathan Distler jdistler at hastingsgroup.com
Fri Jan 5 11:52:10 CST 2001


That looks like a good idea. The other thing I was thinking of would be to
put the column names into another table, but I will try that.

-----Original Message-----
From: thelist-admin at lists.evolt.org
[mailto:thelist-admin at lists.evolt.org]On Behalf Of rudy
Sent: Friday, January 05, 2001 11:44 AM
To: thelist at lists.evolt.org
Subject: Re: [thelist] Easy (?) Database Question


> 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

rudy.ca


---------------------------------------
For unsubscribe and other options, including
the Tip Harvester and archive of TheList go to:
http://lists.evolt.org Workers of the Web, evolt !





More information about the thelist mailing list