Querying Data with Transact-SQL — Question 116
Note: This question is part of a series of questions that present the same scenario. Each question in the series contains a unique solution that might meet the stated goals. Some question sets might have more than one correct solution, while others might not have a correct solution.
After you answer a question in this section, you will NOT be able to return to it. As a result, these questions will not appear in the review screen.
You are building a stored procedure that will be used by hundreds of users concurrently.
You need to store rows that will be processed later by the stored procedure. The object that stores the rows must meet the following requirements:
✑ Be indexable
✑ Contain up-to-date statistics
✑ Be able to scale between 10 and 100,000 rows
The solution must prevent users from accessing one another's data.
Solution: You create a table variable in the stored procedure.
Does this meet the goal?
Answer options
- A. Yes
- B. No
Correct answer: B
Explanation
Creating a table variable does not meet the requirement for concurrent access by multiple users, as table variables have a limited scope and do not provide the necessary isolation for user data. Additionally, while table variables can be indexed and have statistics, they are not suitable for handling a high volume of rows efficiently and lack features such as locking and transaction logging that would be required for concurrent operations. Therefore, the correct answer is No.