Contents Previous Next sqltables

Obtaining the Table Names for a Data Source
Syntax sqltables
See Also sqlconnect , sqlcolnames , sqlnumrows

Returns the table names or tables types for the current data source connection. The value returned is an NR by NC character matrix where NR is the number of tables in the current data source and NC is the length of the longest table name in the current data source. If the argument "type" is present the sqltables function returns the type for each table in the current data source.

If, at the O-Matrix prompt you enter
     sqlconnect("driver={Microsoft Access Driver (*.mdb)};Dbq=c:\omwin\omsql\Contacts.mdb;UID=;PWD=")
     names = sqltables
O-Matrix will create the character matrix names that contains the names of all the tables defined in the Contacts sample database. If you continue the example by entering
     types = sqltables("type")
     print [names, types]
O-Matrix will create the character matrix types and display it together with the names variable as
MSysAccessObjectsSYSTEM TABLE     
MSysACEs         SYSTEM TABLE     
MSysCmdbars      SYSTEM TABLE     
MSysModules      SYSTEM TABLE     
MSysModules2     SYSTEM TABLE     
MSysObjects      SYSTEM TABLE     
MSysQueries      SYSTEM TABLE     
MSysRelationshipsSYSTEM TABLE     
Calls            TABLE            
Company          TABLE            
Contacts         TABLE            
ContactTypes     TABLE            
ShipTo           TABLE            
Switchboard ItemsTABLE            
Tickler          TABLE            
ContactAddress   VIEW             
ContactList      VIEW             
ShippingAddress  VIEW