DatabaseLink`
DatabaseLink`

SQLCreateTable

SQLCreateTable[conn,table,columns]

creates a new table in an SQL connection.

Details and Options

  • To use SQLCreateTable, you first need to load DatabaseLink using Needs["DatabaseLink`"].
  • SQLCreateTable returns an integer specifying the number of rows affected by the query. If the table is created correctly, this integer will always be zero, as no rows are affected when creating a new table.
  • The following options can be given:
  • "Timeout"$SQLTimeoutthe timeout for the query
    "Index" Nonecolumn(s) to index

Examples

open allclose all

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:

Specify whether columns can have null values:

Use different data types:

Specify data length:

Options  (1)

"Index"  (1)

Supply column to be indexed. The index type will depend on database defaults:

Index multiple columns: