t-sql-correctness
Installation
SKILL.md
Write T-SQL that returns the right answer
Three failures. The silent one first, because nothing raises it: the statement succeeds, the row count looks plausible, the answer is wrong. Then PostgreSQL habit, which at least fails loudly. Then overcorrection, hand-rolling what the engine now does natively.
Scope
- Upserts and
MERGEaret-sql-upserts-merge. - JSON and
OPENJSONaret-sql-json-and-openjson. - Table design is
design-azure-sql-schema.
Wrong answers that raise no error
Nothing equals NULL, and nothing is unequal to it either. ANSI_NULLS is permanently ON
and SET ANSI_NULLS OFF is deprecated, so every comparison against NULL is UNKNOWN, and
WHERE keeps only the rows that are TRUE.