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.
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" None database catalog to use "Schema" None database schema to use
Examples
Basic Examples (1)
Needs["DatabaseLink`"]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.
conn = OpenSQLConnection["demo"];SQLColumns[conn]//Short[#, 15]&Get all columns from tables whose names start with "SA":
SQLColumns[conn, "SA%"]Get all columns from a particular table:
SQLColumns[conn, SQLTable["SAMPLETABLE1"]]SQLColumns[conn, {"SAMPLETABLE1", "%"}]Get columns whose names begin with "V" from all tables:
SQLColumns[conn, {"%", "V%"}]SQLColumns[conn, SQLColumn[{"%", "V%"}]]SQLColumns[conn, SQLColumn["V%"]]CloseSQLConnection[conn];