Microsoft SQL Server Connections
TablePro connects to SQL Server 2017 and later via FreeTDS. This covers instances on Windows, Linux, Docker, and Azure SQL Database.
FreeTDS must be built before connecting to SQL Server. Run scripts/build-freetds.sh once to compile the required library.
Quick Setup
Run scripts/build-freetds.sh first. Click New Connection, select SQL Server, enter host/port/credentials/database, and click Create.
Connection Settings
| Field | Default | Notes |
|---|
| Host | localhost | |
| Port | 1433 | |
| Username | sa | SQL Server Authentication only (no Windows Auth) |
| Database | - | |
Example Configurations
Local: host localhost:1433, user sa, database master
Docker: mcr.microsoft.com/mssql/server:2022-latest, env ACCEPT_EULA=Y, SA_PASSWORD must have uppercase/lowercase/digits/symbols
Remote: Standard credentials
Azure SQL: Host server.database.windows.net, user may need user@servername suffix
Features
Schema Selection: Default schema is dbo. Switch with Cmd+K. Shows accessible schemas and tables.
Table Info: Columns (types, nullability, defaults), indexes (clustered/non-clustered), foreign keys, DDL with constraints.
Query Editor (T-SQL, pagination with OFFSET/FETCH):
-- Paginated results
SELECT *
FROM dbo.orders
ORDER BY order_id
OFFSET 0 ROWS FETCH NEXT 50 ROWS ONLY;
-- Row count estimate (fast, uses statistics)
SELECT SUM(p.rows) AS row_count
FROM sys.partitions p
JOIN sys.tables t ON p.object_id = t.object_id
WHERE p.index_id IN (0, 1)
AND t.name = 'orders';
-- View definition
SELECT OBJECT_DEFINITION(OBJECT_ID('dbo.my_view'));
-- List all tables in the current database
SELECT TABLE_SCHEMA, TABLE_NAME
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_TYPE = 'BASE TABLE'
ORDER BY TABLE_SCHEMA, TABLE_NAME;
Schema Editing (T-SQL with bracket notation): ALTER TABLE [dbo].[users] ADD [col] TYPE; EXEC sp_rename 'dbo.table.old', 'new', 'COLUMN'; DROP COLUMN [field]; CREATE INDEX [IX_name] ON [dbo].[table] ([col]);
Foreign Keys: Displayed in structure. Manual query: SELECT fk.name FROM sys.foreign_keys fk...
Authentication: SQL Server Authentication only (username/password). No Windows Auth. Create login: CREATE LOGIN user WITH PASSWORD = 'StrongPassword1!'; CREATE USER user FOR LOGIN user; ALTER ROLE db_datareader ADD MEMBER user;
Troubleshooting
Connection refused: Enable TCP/IP in SQL Server Configuration Manager, verify SQL Server service running, check firewall port 1433, ensure Docker started.
Login failed: Verify credentials, check mixed-mode authentication enabled: SELECT SERVERPROPERTY('IsIntegratedSecurityOnly'); Set to 2 for mixed mode.
FreeTDS not found: Run scripts/build-freetds.sh to compile and place library.
Limitations: SQL Server Auth only, no Windows Auth, named instances unsupported (use IP:port), NTEXT/TEXT/IMAGE deprecated (use *MAX types).