prevent-sql-injection
Handles SQL injection on Azure SQL Database beyond parameterisation: a typed sp_executesql parameter matches nothing where the same input concatenated into EXEC() returns every row; QUOTENAME returns NULL above 128 characters, so the batch built from it becomes NULL and does nothing; a dynamic ORDER BY built from one CASE over mixed types fails…
Full publisher description
Handles SQL injection on Azure SQL Database beyond parameterisation: a typed sp_executesql parameter matches nothing where the same input concatenated into EXEC() returns every row; QUOTENAME returns NULL above 128 characters, so the batch built from it becomes NULL and does nothing; a dynamic ORDER BY built from one CASE over mixed types fails only for the sort key on the lower-precedence branch; dynamic SQL breaks the ownership chain, so EXECUTE AS decides what it may touch; and Always Encrypted refuses a literal (Msg 206). Use for a general injection question or a pre-production review, when a QUOTENAME-built statement returns and raises nothing, when a sort-by-column feature throws an operand type clash for one column only, when a procedure works until its query becomes dynamic, or when an encrypted column will not take a literal. Row level tenant isolation is rls-multi-tenant.
Source details
Read SKILL.md ↗ · Browse skill folder ↗
microsoft/microsoft-sql
plugins/microsoft-sql-vscode/skills/prevent-sql-injection/SKILL.mdPinned revision eeb1c6867c2d128763516a1aad41671c593cc189
Source checked
Reviewed licence: MIT
repository
Reviewed publisher revision ↗ · 2026-11-22
This skill page is available in English. Publisher instructions stay in their original language.