Question 150
A procedure builds an optional filter query by concatenating a user's search text into SQL. What observable outcome proves the recommendation worked?
Explanation
Correct Answer
Parameterized dynamic SQL separates values from executable statements and reduces injection risk. The observation “A hostile quote-containing test is treated as data and does not alter SQL structure” directly confirms the chosen action worked for this situation: A procedure builds an optional filter query by concatenating a user's search text into SQL.
Incorrect Answers
Views can provide a data-access interface when underlying object permissions are managed appropriately. This observation would not establish that the required result occurred for A procedure builds an optional filter query by concatenating a user's search text into SQL. The confirming test is: A hostile quote-containing test is treated as data and does not alter SQL structure.
Suppressing SQL errors conceals failed transactions; THROW propagates a meaningful failure. This observation would not establish that the required result occurred for A procedure builds an optional filter query by concatenating a user's search text into SQL. The confirming test is: A hostile quote-containing test is treated as data and does not alter SQL structure.
SQL Server UNIQUE and filtered unique indexes differ in how missing values can be represented. This observation would not establish that the required result occurred for A procedure builds an optional filter query by concatenating a user's search text into SQL. The confirming test is: A hostile quote-containing test is treated as data and does not alter SQL structure.