You create a table by using the following Transact-SQL Statement:
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.
Use the Check Syntax button to verify your work. Any syntax or spelling errors will be
reported by line and character position.
Answer:
SELECT IIF (Name IS NOT NULL, Name, SubName)
Explanation:
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
No comments:
Post a Comment