In ColdFusion is there a way to specify a field in a query when you do not know what the name of the field is?
What to be able to select any table in a database with one page.
I have done it with ASP, but ColdFusion?
You talk about specifying a field that you don't know the name of, but then you say what you're trying to do is select any table... so it's a little unclear about what it is you're trying to do.
The exact syntax for getting a list of tables in a database differs from type of database to type of database... for example for Oracle you would use:
Code:
<cfquery name="ALLDATABASES" datasource="MYSOURCE">
SELECT * FROM ALL_TABLES
</cfquery>
for MS SQL Server, you would use:
Code:
<cfquery name="GetDatabases" datasource="MYSOURCE">
SELECT name FROM sysobjects WHERE type = 'U'
</cfquery>
Then you could get a list of columns/fields in that table by executing a short query on the desired table, and reading the columnlist property:
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.