Before connecting SQL Server
Supply host, port, database, username and password for a SQL Server instance reachable by TTSQL. The adapter uses the Tds driver; confirm database authentication and the instance's network listener with your administrator.
Choose the schema containing your reporting tables. The examples use dbo.orders. A table in sales.orders is a different object and should be named explicitly in project context.
Give the prompt the right dialect and context
SQL Server commonly uses square brackets to quote identifiers, such as [order]. Use single quotes for strings and schema-qualified names such as dbo.orders. PostgreSQL LIMIT and ::date are not T-SQL syntax.
Use datetime2 for the teaching ordered_at column. In SQL Server, timestamp is a rowversion binary value, not a date and time type. The examples use features available in SQL Server 2012 and later.
Schema used in these examples
customers(id INTEGER PRIMARY KEY, name TEXT, country TEXT); orders(id INTEGER PRIMARY KEY, customer_id INTEGER REFERENCES customers(id), ordered_at TIMESTAMP, status TEXT, total DECIMAL(12,2)). Each order has one customer. total is the order amount in a single reporting currency; paid means recognized revenue in this teaching dataset. Timestamps use UTC. These are example tables, not tables TTSQL creates.
Translate TEXT and TIMESTAMP to equivalent column types for your engine. Use your own database, schema and table qualifiers. Each example states its reporting grain and sorting rule.
Review these SQL Server details
OFFSET/FETCH pagination requires ORDER BY; a stable unique order avoids overlapping or missing rows caused by ties, although concurrent data changes can still affect offset paging.
Keep dates typed and use unambiguous date construction or parameter values. Do not assume a language-dependent string such as '09/05/2026' means the same date on every SQL Server session.
Generate, review, then choose whether to run
Select the matching database type and confirm your project's schema context before generating. Review the returned SQL against the schema and the metric you intended. A successful connection test does not prove that every table or operation is authorized.
TTSQL's POST /api/v1 endpoint generates SQL and returns executed: false. Query execution is a separate manual Run action in the workspace, subject to the configured connection and policies. The examples below are educational SELECT statements, not live results from your database.
Official SQL Server references
Check your engine version and account configuration when adapting a function or connection setting.