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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get Field Name and Field Size for a Table 1

Status
Not open for further replies.

LyndonOHRC

Programmer
Sep 8, 2005
603
US
I've already asked this question on the Microsoft: Access Queries and JET SQL Forum and no one had a practical solution.

I'm using the following code to get the list of table names from a database then printing the field names from columnlist. I would like to print field name and field size if there is any way to do it.
Code:
<cfquery name="GetTableNames" datasource="ORI">
 SELECT Name
 FROM MSysObjects
 WHERE Type=1 AND Flags=0
</cfquery>
<cfoutput query="GetTableNames">
 <cfquery name="GetFieldNames" datasource="ORI">
  Select *
  From #GetTableNames.Name#
 </cfquery>
 #GetTableNames.Name# (#NumberFormat(GetFieldNames.RecordCount)# Records)<br>
 <cfloop from="1" to="#ListLen(GetFieldNames.columnlist)#" index="i">
  #ListGetAt(GetFieldNames.columnlist,i)#,<br>
 </cfloop>
</cfoutput>
Thanks

Lyndon

---People Remember about 10% of what you say ---They never forget how you made them feel. Covey
 
Clarification: Tabledefs contains all of the table properties, including field data types. Descriptions are another property accessible through the collection.
 
Thanks. I wondered why I couldn't find any code examples.

Lyndon

---People Remember about 10% of what you say ---They never forget how you made them feel. Covey
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top