Skip to content
DuckDB community extension

mssql

Connect DuckDB to Microsoft SQL Server via native TDS (including TLS).

01 / SETUP

Install and load

Run these commands in a Haybarn SQL session. The extension is available from the community repository.

Haybarn 2.0.0 · SQL
INSTALL mssql FROM community;
LOAD mssql FROM community;

Using upstream DuckDB? Follow the maintainer’s installation instructions.

02 / QUERY

Usage example

SQL
ATTACH 'Server=localhost,1433;Database=master;User Id=sa;Password=YourStrong!Passw0rd;TrustServerCertificate=yes' AS ms (TYPE mssql);
SELECT * FROM ms.dbo.your_table LIMIT 5;

Provided by hugr-lab. Not yet verified on Haybarn 2.0.0.

Sample data & setup

About this extension

DuckDB connector for Microsoft SQL Server, Azure SQL and Microsoft Fabric over a native TDS 7.4 implementation — no ODBC, JDBC or FreeTDS required. Attach a server as a DuckDB catalog and query, join, and bulk-load it alongside your local data.

Reading. Attached tables come with schema/table catalog integration and a lazily loaded metadata cache. A SELECT the extension can write in T-SQL — joins, aggregates, GROUP BY, window functions, ORDER BY / LIMIT, subqueries, CTEs — runs on SQL Server as one statement (EXPLAIN shows it); the rest streams through projection and filter pushdown and a columnar, batch-decoded result path.

Project overview from the community descriptor.

Documentation and resources

Project and build details
Repository
hugr-lab/mssql-extension
License
MIT
Maintainers
VGSML, oluies
Written in
C++
Build source
bfd347ffa89d
Build definition
Community descriptor