exam questions

Exam 70-761 All Questions

View all questions & answers for the 70-761 exam

Exam 70-761 topic 1 question 29 discussion

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

You have a database that contains the following tables:

Customer -


CustomerAudit -

Where the value of the CustomerID column equals 3, you need to update the value of the CreditLimit column to 1000 for the customer. You must ensure that the change to the record in the Customer table is recorded on the CustomerAudit table.
Which Transact-SQL statement should you run?
A.

B.

C.

D.

  • A. Option A
  • B. Option B
  • C. Option C
  • D. Option D
Show Suggested Answer Hide Answer
Suggested Answer: D 🗳️
The OUTPUT Clause returns information from, or expressions based on, each row affected by an INSERT, UPDATE, DELETE, or MERGE statement. These results can be returned to the processing application for use in such things as confirmation messages, archiving, and other such application requirements. The results can also be inserted into a table or table variable. Additionally, you can capture the results of an OUTPUT clause in a nested INSERT, UPDATE, DELETE, or MERGE statement, and insert those results into a target table or view.
Note: If the column modified by the .RITE clause is referenced in an OUTPUT clause, the complete value of the column, either the before image in deleted.column_name or the after image in inserted.column_name, is returned to the specified column in the tablevariable.
Incorrect Answers:
C: The deleted.Creditlimit should be inserted in the second column, the OldCreditLimit column, not the third column.
References:
https://msdn.microsoft.com/en-us/library/ms177564.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
chaoxes
Highly Voted 4 years, 9 months ago
D. is correct, tested
upvoted 5 times
...
Andy7622
Most Recent 4 years, 5 months ago
why should the WHERE clause go last step . It doesn't seem logical. First step we do update for specific ID which is mentioned in WHERE clause then we ensure changes were made in Audit table
upvoted 1 times
...
auuuu
4 years, 9 months ago
I think A is also correct. If not why?
upvoted 1 times
Max34
4 years, 8 months ago
"You must ensure that the change to the record in the Customer table" means you should use OUTPUT to verify.
upvoted 2 times
...
A_Cieluch
4 years, 7 months ago
You would add the same value CreditLimit as the old and the new limit at the same time.
upvoted 1 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