T-SQL differences
Overview
SQL Server 2022 uses Transact-SQL (T-SQL), including TOP, OFFSET/FETCH, IDENTITY and OUTPUT. Do not send PostgreSQL LIMIT or RETURNING syntax unchanged. Use deterministic ordering for pagination.
First example
SELECT id,cents FROM dc_item ORDER BY cents,id LIMIT 2;Observed SQLite result (rows in JSON):
[ [ 1, 100 ], [ 2, 200 ]]How it works
TOP limits rows and OFFSET/FETCH follows ORDER BY. OUTPUT can expose inserted and deleted values but output order is not guaranteed; returned rows alone do not establish commit success. Bracket quoting is vendor-specific; double quotes depend on QUOTED_IDENTIFIER. BIT is not a general SQL boolean predicate type. CONCAT treats NULL as empty text, unlike || in SQLite. T-SQL has DATEADD and different procedure, trigger and catalog conventions. MERGE is not a drop-in replacement for ON CONFLICT; review concurrency and constraints.
Practical example
SELECT CONCAT('A',NULL), 'A' || NULL;Observed SQLite result (rows in JSON):
[ [ "A", null ]]Practice and mistakes
Practice: express a first page in SQLite and then translate it to TOP or OFFSET/FETCH. Hint: order by cents,id. Mistake: treating OUTPUT rows as proof that a transaction committed.
SQL Server 2022 example — NOT RUN
SELECT id,cents FROM dc_item ORDER BY cents,id OFFSET 0 ROWS FETCH NEXT 2 ROWS ONLY;Expected result, not executed: "Rows (1,100),(2,200)."