exam questions

Exam 70-461 All Questions

View all questions & answers for the 70-461 exam

Exam 70-461 topic 1 question 152 discussion

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

SIMULATION -
You create a table by using the following Transact-SQL Statement:

You need to return a result set that has a single column named DisplayInformation. The result set must contain the Name value if the Name value is NOT NULL, otherwise the result set must contain the SubName value.
Part of the correct Transact-SQL has been provided in the answer area below. Enter the code in the answer area that resolves the problem and meets the stated goals or requirements. You can add code within the code that has been provided as well as below it.


Show Suggested Answer Hide Answer
Suggested Answer: Please review the explanation part for this answer.
SELECT IIF (Name IS NOT NULL, Name, SubName)
Update line 1 to get the following:
SELECT IIF (Name IS NOT NULL, Name, SubName)
FROM Products;
IIF returns one of two values, depending on whether the Boolean expression evaluates to true or false in SQL Server.
Syntax: IIF ( boolean_expression, true_value, false_value )
If the value of expression is NULL, IS NULL returns TRUE; otherwise, it returns FALSE.
If the value of expression is NULL,IS NOT NULL returns FALSE; otherwise, it returns TRUE.
To determine whether an expression is NULL, use IS NULL or IS NOT NULL instead of comparison operators (such as = or !=). Comparison operators return
UNKNOWN when either or both arguments are NULL
References:
https://msdn.microsoft.com/en-us/library/hh213574.aspx
https://msdn.microsoft.com/en-us/library/ms188795.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
lilupv
Highly Voted 4 years, 9 months ago
Why not ISNULL?
upvoted 5 times
...
vitwin
Most Recent 4 years, 5 months ago
need: SELECT IIF (Name IS NOT NULL, Name, SubName) AS DisplayInformation
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 ...