SQLColumnNames
This feature is not supported on the Wolfram Cloud.

SQLColumnNames[conn]
returns a list of 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.

更多信息更多信息

  • 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"Nonedatabase catalog to use
    "Schema"Nonedatabase schema to use

范例范例打开所有单元关闭所有单元

基本范例  (1)基本范例  (1)

In[1]:=
Click for copyable input

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 package, as described in Using the Example Databases.

Open a connection:

In[2]:=
Click for copyable input
In[3]:=
Click for copyable input
Out[3]//Short=

Get pairs from tables whose names start with "SA":

In[4]:=
Click for copyable input
Out[4]=

Get pairs from a particular table:

In[5]:=
Click for copyable input
Out[5]=

Here is another way:

In[6]:=
Click for copyable input
Out[6]=

Get pairs for columns whose names begin with "V" in any table:

In[7]:=
Click for copyable input
Out[7]=

Equivalently:

In[8]:=
Click for copyable input
Out[8]=

Here is another way:

In[9]:=
Click for copyable input
Out[9]=

Extract just the column names:

In[10]:=
Click for copyable input
Out[10]=
In[11]:=
Click for copyable input