Forum Moderators: phranque

Message Too Old, No Replies

Cold Fusion SQL Question

         

brucec

6:19 pm on Jul 7, 2004 (gmt 0)

10+ Year Member



I don't know what topic this really belongs in. So, I am going general with this.

Is there a way for me to list all tables and their associated field names using SQL and Cold Fusion code?

Any help is appreciated.

thorlabs

3:32 pm on Aug 18, 2004 (gmt 0)

10+ Year Member



Assuming an SQL database.

SELECT name
FROM sysobjects
WHERE (xtype = 'u')

this will return all USER tables in your database

thorlabs

3:38 pm on Aug 18, 2004 (gmt 0)

10+ Year Member



even better.

SELECT name, id
FROM sysobjects
WHERE (xtype = 'u')

will give you all tables.

SELECT name
FROM syscolumns
WHERE (id = #ID#)

will give you FIELD NAMES for that particular table.