SQL::Schema Object


SQL::Schema Object properties and methods.

A SQL::Schema object (a database description) is a container for one or more SQL::TableInfo objects (table descriptions).


This example creates an array containing five SQL::TableInfo objects.

As of the writing of this help topic, it is impossible to DIM an array of objects based on a class. The following code sample shows a work-around.
dim ti as SQL::TableInfo
dim arr[5] as P
arr[1] = ti
for i = 2 to 5
    arr[i] = ti.clone()
next i
The TableInDependencyOrder property lists all tables in the order they should be created and populated in copying them to a new database.


This example interactive window session shows how to use the sql::schema object and the tablesReferencing and tablesReferencedBy methods of the sql::schema object. The connection string is pointing to a SQL Server version of Northwind.

dim cn as sql::connection 
 = .T.
 dim s as sql::Schema
 = .T.

 = 2
 dim tiCustomer as sql::TableInfo
 tiCustomers = s.table[2]
 r1 = s.TablesReferencedBy(tiCustomers)
 = 0
 r2 = s.TablesReferencing(tiCustomers)
 = 1
 = "Orders"
 dim tiOrders as sql::TableInfo 
 = 5
 tiOrders = s.table[5]
 r3 = s.TablesReferencedBy(tiOrders)
 = 3
 = "Customers"
 = "Employees"
 = "Shippers"
 r4 = s.TablesReferencing(tiOrders)
 = 1

 = "Order Details"



The schema in XML format.


The unique name of the table. Note: The table must be unique for the owner, but may not be globally unique.


The name of the API active when this object was created.


The name of the syntax at the time the object was created.


The comment stored for the table (if the database supports it).


The SQL database user or group that owns the table.


String Catalog property


String Schema property


An array of table ( SQL::TableInfo ) definitions.


An array of table ( SQL::TableInfo ) definitions ordered from the top of the dependency hierarchy.


CallResult property


AddTable Method

Add a Table.

Clear Method

The Clear() method clears out the schema as if it had just been created.

Clone Method

The SQL::Schema.Clone() method makes a copy of a SQL::Schema object and its properties.

ListTables Method

The ListTables() method returns a list of tables in the current cache for the current database.

ListTablesWithTypes Method

Return a list of tables for the current database suffixed with (<type>).

TableNumber Method

Get the index of a Table from the name.

TablesReferencedBy Method

Generate a collection of tables referenced by this table.

TablesReferencing Method

Generate a collection of tables that reference this table.

UpdateStatistics Method

Gather statistical information about the actual tables in the schema.

See Also