exam questions

Exam 70-761 All Questions

View all questions & answers for the 70-761 exam

Exam 70-761 topic 1 question 4 discussion

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

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 create a table named Customer by running the following Transact-SQL statement:

You must insert the following data into the Customer table:

You need to ensure that both records are inserted or neither record is inserted.
Solution: You run the following Transact-SQL statement:

Does the solution meet the goal?

  • A. Yes
  • B. No
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️
As there are two separate INSERT INTO statements we cannot ensure that both or neither records are inserted.

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
Anirudh_net
3 years, 3 months ago
B is correct
upvoted 1 times
...
Vermonster
4 years, 5 months ago
B is correct - accepting/rejecting both requires a BEGIN/END/COMMIT TRAN construct that doesn't exist. Wihtout it, each INSERT fails independently and error isn't severe enough to abort the connection
upvoted 1 times
...
Billybob0604
4 years, 7 months ago
I think the statement they want to make that if a fatal error happens such as a server crash, right before the crash the one record could have been inserted whereas the other one hasn't. If you want all or nothing the use SET XACT_ABORT ON I would say. But this is a rather far fetched answer.
upvoted 1 times
Hoglet
4 years, 6 months ago
Both or neither would require the use a Transaction. As there is no Transaction, it can't work. SET XACT_ABORT by itself would not achieve anything.
upvoted 1 times
...
...
TheDUdeu
4 years, 9 months ago
Querying Data with Transact-SQL Book has an example like this and this would be B because if there is an error in the second insert it but the first one is fine, it will insert the first one.
upvoted 1 times
...
gmu
4 years, 9 months ago
The example works fine, but if you try to insert a number that violate the check constraint in one of the statements the insert fails only for that statement. The correct answer is NO.
upvoted 1 times
...
ricky59
5 years ago
I think the answer is A because GO designates a batch... if there is any kind of error, the whole batch will not execute
upvoted 1 times
Andy7622
4 years, 7 months ago
Sorry, You aren't correct. There should be either TRANSACTION or one INSERT statement for with to rows.
upvoted 1 times
...
...
CristianCruz
5 years ago
Sorry, answer is B, As there are two separate INSERT INTO statements we cannot ensure that both or neither records are inserted.
upvoted 2 times
...
CristianCruz
5 years ago
Sorry, As there are two separate INSERT INTO statements we cannot ensure that both or neither records are inserted.
upvoted 3 times
...
CristianCruz
5 years, 1 month ago
ANSWARE IS A BECAUSE TOWNID IS CREATED AS NULL
upvoted 1 times
trickytree
5 years, 1 month ago
Correct Answer is B as shown. This needs to be 'all or nothing', but writing 2 separate inserts does not meet this requirement. If the first insert works it is committed even if the second fails.
upvoted 3 times
akvegi
4 years, 10 months ago
correct but if u execute 2 statements at a time with wrong data insert into testTop (id, name) values (2,a1) insert into testTop (id, name) values (2,'b1') go like this it is working scenario Answer is A
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 ...