exam questions

Exam 70-761 All Questions

View all questions & answers for the 70-761 exam

Exam 70-761 topic 1 question 112 discussion

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

DRAG DROP -
You have a database containing the following tables:

Servers -


Errors -

You have a user-defined, scalar function named IPLookup that takes a DNS name as a parameter and returns the IP address of the server. You have an additional user-defined, scalar function named DNSLookup, that takes an IP address as a parameter and returns a DNS name.
You create a view named vwErrors by running the following Transact-SQL statement:

You need to insert data by using the view.
How should you complete the Transact-SQL statement? To answer, drag the appropriate Transact-SQL segments to the correct location. Each Transact-SQL segments may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content.
Select and Place:

Show Suggested Answer Hide Answer
Suggested Answer:
References:
https://docs.microsoft.com/en-us/sql/t-sql/queries/output-clause-transact-sql

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
Billybob0604
4 years, 5 months ago
"you need to insert data by using the view". This means that the trigger needs to fire when this happens. I would say AFTER INSERT, as the view is used to insert in an (unknown) table. But this is unclear from the question.
upvoted 1 times
...
Vermonster
4 years, 5 months ago
Correct - INSTEAD OF because we are trying to log errors and can't do that with AFTER TRIGGER because it won't fire
upvoted 2 times
...
kimalto452
4 years, 6 months ago
answer correct
upvoted 4 times
...
BossHoggs
4 years, 6 months ago
For anyone that was confused by the "FROM inserted" part of the trigger - check out "virtual tables". This talks briefly about them: https://www.sqlservertutorial.net/sql-server-triggers/sql-server-create-trigger/
upvoted 2 times
...
TomAbg
4 years, 7 months ago
Why use INSTEAD OF ? A think correct block [after insert]. Share with your opinions.
upvoted 1 times
BossHoggs
4 years, 6 months ago
My understanding is that since we're actually only inserting into one true table, we'd want an "instead of" trigger. If we wanted to update a true table, and have a trigger then update another table as well (such as an audit table), then we'd want to use an After Insert. In this case, I think it makes sense to use an instead of trigger - since we're not actually trying to insert into the view, but rather insert into the underlying table. I think this was helpful: https://www.sqlservertutorial.net/sql-server-triggers/sql-server-create-trigger/
upvoted 1 times
Billybob0604
4 years, 5 months ago
No , but the view is 'used' to insert it says. Meaning that BEFORE firing the trigger the view IS used to insert ino an (unknown) table. INSTEAD OF makes no sense.
upvoted 1 times
...
...
Angelcr
4 years, 5 months ago
Because instead of inserting a table directly, what is done is inserting the default values of the temporary table INSERTED
upvoted 1 times
...
...
getstoopid
4 years, 10 months ago
This question doesn't make any sense
upvoted 2 times
...
Anette
5 years ago
Something is wrong here in the question: IPLookup takes a DNS name as a parameter and returns the IP address of the server While in the code IPLookup is taking IP and returning DNS bohh
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 ...