SQLColumnNames[conn]
returns a list of {table,name} pairs for each column in an SQL connection.
SQLColumnNames[conn,table]
returns a list of the columns in table.
SQLColumnNames[conn,SQLTable[table]]
returns a list of the columns in table.
SQLColumnNames[conn,{table,column}]
returns a list of the columns in table matching column.
SQLColumnNames[conn,SQLColumn[{table,column}]]
returns a list of the columns in table matching column.
SQLColumnNames[conn,SQLColumn[column]]
returns a list of the columns in any table matching column.
SQLColumnNames
SQLColumnNames[conn]
returns a list of {table,name} pairs for each column in an SQL connection.
SQLColumnNames[conn,table]
returns a list of the columns in table.
SQLColumnNames[conn,SQLTable[table]]
returns a list of the columns in table.
SQLColumnNames[conn,{table,column}]
returns a list of the columns in table matching column.
SQLColumnNames[conn,SQLColumn[{table,column}]]
returns a list of the columns in table matching column.
SQLColumnNames[conn,SQLColumn[column]]
returns a list of the columns in any table matching column.
Details and Options
- To use SQLColumnNames, 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"];SQLColumnNames[conn]//ShortGet {table,column} pairs from tables whose names start with "SA":
SQLColumnNames[conn, "SA%"]Get {table,column} pairs from a particular table:
SQLColumnNames[conn, SQLTable["SAMPLETABLE1"]]SQLColumnNames[conn, {"SAMPLETABLE1", "%"}]Get {table,column} pairs for columns whose names begin with "V" in any table:
SQLColumnNames[conn, {"%", "V%"}]SQLColumnNames[conn, SQLColumn[{"%", "V%"}]]SQLColumnNames[conn, SQLColumn["V%"]]Extract just the column names:
SQLColumnNames[conn, SQLTable["SAMPLETABLE1"]][[All, 2]]CloseSQLConnection[conn];