Microsoft SQL Server
UQL runs on SQL Server 2017 and up through the pure-JavaScript mssql driver.
Install and connect
Section titled “Install and connect”npm install uql-orm mssqlimport { MsSqlQuerierPool } from 'uql-orm/mssql';
export const pool = new MsSqlQuerierPool({ server: 'localhost', database: 'app', user: 'app', password: process.env.DB_PASSWORD, options: { encrypt: true, trustServerCertificate: false },});The pool takes mssql’s own config. See Pool for sizing and shutdown.
What differs
Section titled “What differs”Strings are always NVARCHAR, and comparisons follow the database collation, case-insensitive by default. $regex is case-sensitive and needs SQL Server 2025 at compatibility level 170 (REGEXP_LIKE). $text throws, since CONTAINS needs a full-text catalog UQL does not create.
Vector search needs SQL Server 2025 and a declared dimensions. It is exact, computing every distance with VECTOR_DISTANCE, because the DiskANN index is still in preview.
OUTPUT INSERTED returns one id per row, so insertMany ids are exact. Writing an explicit value into an identity column works too; UQL wraps that insert in SET IDENTITY_INSERT.
The server refuses two cascade paths to one table (error 1785) and has no RESTRICT; the default NO ACTION avoids both. The uuidv7() SQL value throws, so generate v7 ids in code with onInsert. Streaming uses the driver’s own row stream.
Migrations
Section titled “Migrations”Migrations diff the schema like on any other engine. SQL Server names column defaults, CHECK and UNIQUE constraints itself, so UQL drops them before dropping a column and restores the default after a retype. Renames use sp_rename, and creates are guarded by catalog lookups in place of IF NOT EXISTS.