IMPORT DATABASE Statement

Imports a table, view, or query from a Microsoft SQL Server, PostgreSQL, or MySQL database. The data can be copied into the notebook for fast offline access, or a live link to the remote database can be created.

Syntax


Parameters

Options

Examples

-- It's convenient to use a variable to hold the connection string.
-- The || operator is string concatenation in SQLite.
DECLARE @connectionString =
'Data Source=localhost\SQLEXPRESS;' ||
'Initial Catalog=Northwind;' ||
'Integrated Security=True';

-- Import the remote table 'foo_bar' into a new table of the same
-- name in the notebook. A one-time copy of the data is performed.
IMPORT DATABASE 'mssql'
CONNECTION @connectionString
TABLE foo_bar;

-- Import a very large remote table by creating a live link. The
-- data is not copied into the notebook. Instead the remote table is
-- queried on demand.
IMPORT DATABASE 'mssql'
CONNECTION @connectionString
TABLE large_table
OPTIONS (LINK: 1);