DatabaseLink`
DatabaseLink`

SQLColumns

SQLColumns[conn]

returns the SQLColumn object for each column in an SQL connection.

SQLColumns[conn,table]

returns the columns in table.

SQLColumns[conn,SQLTable[table]]

returns the columns in table.

SQLColumns[conn,{table,column}]

returns the columns in table matching column.

SQLColumns[conn,SQLColumn[{table,column}]]

returns the columns in table matching column.

SQLColumns[conn,SQLColumn[column]]

returns the columns in any table matching column.

Details and Options

  • To use SQLColumns, you first need to load DatabaseLink using Needs["DatabaseLink`"].
  • Table and column specifications may include SQL wildcards.
  • The following options can be given:
  • "Catalog"Nonedatabase catalog to use
    "Schema"Nonedatabase schema to use

Examples

Basic Examples  (1)

If you find that the examples in this section do not work as shown, you may need to install or restore the example database with the "DatabaseLink`DatabaseExamples`" package, as described in Using the Example Databases.

Open a connection:

Get all columns from tables whose names start with "SA":

Get all columns from a particular table:

Here is another way:

Get columns whose names begin with "V" from all tables:

Equivalently:

Here is another way: