Question 990
A tenant administration tool builds a query with a user-supplied text filter and currently concatenates it into SQL. Which implementation step most directly addresses this requirement?
Explanation
Correct Answer
Sp_executesql parameters separate user values from the SQL text and reduce injection risk. Parameterize values and allowlist unavoidable object identifiers. Inputs containing quotes remain data and cannot alter SQL structure.
Incorrect Answers
That change leaves the underlying defect unresolved: Parameter binding separates data from SQL syntax; identifiers require a vetted allowlist.
The proposed implementation creates the wrong boundary because Object identifiers cannot be parameterized as values; restrict to approved names and quote appropriately.
This step would not produce the required behavior: Injection prevention and least-privilege access are different boundaries; enforce both. This alternative omits a necessary contract or control and leaves the tested failure path open.