Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to display database structure with CF

Status
Not open for further replies.

danrjohn

Programmer
Jan 23, 2008
1
US
I took over the support of a web page that was developed with coldfusion, and I like to know if there is an easy way to determine the database structure through a cf? I've done a google on this and come up with a suggestion of using

"SELECT *
FROM Information_Schema.Tables
ORDER BY Table_Name

SELECT COLUMN_NAME, DATA_TYPE, CHARACTER_MAXIMUM_LENGTH
FROM Information_Schema.Columns
WHERE Table_Name = ‘#Table_Name#’

ORDER BY Ordinal_Position"

But I'm a bit confused on what are reserved names and what are not. Can someone help with this or is there an easier way to get this information?

Thanks!
 
those are two separate SELECT statements

the first one will list all your tables

the second one will list all the columns for a specific table

do you have to do this via coldfusion? don't you have some other way to get at your database? like an SQL window in a GUI tool or something?

if so, run those queries there



r937.com | rudy.ca
 
What database? The syntax you posted doesn't work with every flavor.

Phil Hegedusich
Senior Programmer/Analyst
IIMAK
-----------
A virtual machine ate my accounting data. I transferred it to a physical box, then I beat it to smithereens with a sledgehammer. I feel better.
 
(addendum) Just curious, because I got tired of messing with MSysObjects.
 
not sure if it works in access or not

works in sql server, so at least we know that microsoft is well aware of the standard...

r937.com | rudy.ca
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top