DATABASELINK 教程

Dropping Tables

SQLDropTable drops tables from a database. An alternative, using raw SQL, is demonstrated in "Dropping Tables with Raw SQL".

If you find that the examples in this tutorial 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".

The result of SQLDropTable is an integer specifying the number of rows affected by the query.

SQLDropTable[table]drop a table from a database

Dropping a table from a database.

Here is an example that drops a table. This loads DatabaseLink and connects to the demo database.

In[1]:=
Click for copyable input

A new table, TEST, is created and data is inserted.

In[3]:=
Click for copyable input

This drops the table.

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

SQLTableNames verifies that the table is removed from the database.

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

SQLDropTable accepts one option.

option name
default value
"Timeout"Automaticset the timeout for a query

Option of SQLDropTable.

The option can be used to cancel a query if it takes too long to execute.

This closes the connection.

In[7]:=
Click for copyable input
New to Mathematica? Find your learning path »
Have a question? Ask support »