KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Using an SQL query to get an ordered list of table and field numbers
PRODUCT: 4D Developer | VERSION: 11 | PLATFORM: Mac & Win
Published On: July 23, 2008
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

An easy way to get a list of all tables and fields in a database, sorted by their ID numbers, is to use SQL to query the system tables, like this:

Begin SQL
SELECT TABLE_NAME, TABLE_ID, COLUMN_NAME, COLUMN_ID
FROM _USER_COLUMNS
ORDER BY TABLE_ID, COLUMN_ID
INTO :lbox1
End SQL


Here the information is put into a listbox on a form:



For more information on using SQL in 4D, see the 4D SQL Reference at:

https://www.4d.com/docs/QLC/QLCMDUS.HTM.