exam questions

Exam 70-762 All Questions

View all questions & answers for the 70-762 exam

Exam 70-762 topic 1 question 37 discussion

Actual exam question from Microsoft's 70-762
Question #: 37
Topic #: 1
[All 70-762 Questions]

HOTSPOT -
You are maintaining statistics for a database table named tblTransaction. The table contains more than 10 million records.
You need to create a stored procedure that meets the following requirements:
✑ On weekdays, update statistics for a sample of the total number of records in the table.
✑ On weekends, update statistics by sampling all rows in the table.
A maintenance task will call this stored procedure daily.
How should you complete the stored procedure? To answer, select the appropriate Transact-SQL segments in the answer area.
NOTE: Each correct selection is worth one point.
Hot Area:

Show Suggested Answer Hide Answer
Suggested Answer:
Box 1: UPDATE STATISTICS -

Box 2: SAMPLE 20 PERCENT -
UPDATE STATISTICS tablenameSAMPLE number { PERCENT | ROWS }
Specifies the approximate percentage or number of rows in the table or indexed view for the query optimizer to use when it updates statistics. For PERCENT, number can be from 0 through 100 and for ROWS, number can be from0 to the total number of rows.

Box 3: UPDATE STATISTICS -

Box 4: WITH FULLSCAN -
FULLSCAN computes statistics by scanning all rows in the table or indexed view. FULLSCAN and SAMPLE 100 PERCENT have the same results. FULLSCAN cannot be used with the SAMPLE option.
References:
https://msdn.microsoft.com/en-us/library/ms187348.aspx

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
julie2020
Highly Voted 4 years, 8 months ago
Correct
upvoted 11 times
...
Alex5x
Most Recent 4 years, 6 months ago
Since on weekdays we should update statistics for a sample of the total number of RECORDS in the table, I would select WITH SAMPLE 200000 ROWS.
upvoted 2 times
kimalto452
4 years, 4 months ago
200k row is no representative for "The table contains more than 10 million records." 2% cant be representative...
upvoted 2 times
...
...
Nickname17
4 years, 12 months ago
Why 20% instead of 200000?
upvoted 3 times
Engineerdocing
4 years, 11 months ago
Because you want a representative amount, not a fixed amount
upvoted 14 times
...
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago