> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lancedb.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Attach a table with SQL

> Register an existing Lance table at a location relative to its database.

Enterprise only

Use `ATTACH TABLE` in LanceDB Enterprise to add an existing Lance table to a
database. The statement registers the table in place and keeps its existing
schema and data.

```sql theme={"theme":{"light":"vitesse-light","dark":"catppuccin-mocha"}}
ATTACH TABLE analytics.public.events WITH ('location'='imports/events.lance');

SELECT * FROM analytics.public.events;
```

The location is relative to the storage root of the target database. If the
database uses a storage integration, the table uses that integration for access.
The path must identify an existing Lance table. Materialized views use their
own catalog type. The catalog discovers Lance tables in root-level `.lance`
directories. Use a subdirectory such as `imports/` for tables you want to
attach. Absolute filesystem paths, cloud URIs, and paths that traverse outside
the database are rejected.
The table's existing versions must have no configured base paths. Live Lance
branches use base paths, so tables with live branches are ineligible. On the
local filesystem, the attached directory must be free of symbolic links.

The command requires a native manifest-backed database, database ownership, and
permission to create tables in the target namespace. The table name must be
available, and the location must be separate from other catalog objects.

An attached table follows the normal table lifecycle. `DROP TABLE` removes the
registration and deletes the table data at the attached location.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.