SIMULATION
You have a database named SALES that stored the sales data and the salespeople for your company.
You need to create a function that is passed a ProductID and then returns a list of SalesOrderID values for orders that must be associated to a salesperson in the future. The function must be able to return multiple SalesOrderID values.
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.
Correct Answer:
Please review the explanation part for this answer
Explanation/Reference:
Explanation:
WHERE header.SalesPersonID IS NULL
On line 8 add: IS NULL to get:
CREATE FUNCTION dbo.OrdersWithNoSalesPerson(@ProductID INT)
RETURNS
AS
header.SalesOrderID
FROM Sales.SalesOrderDetail detail
INNER JOIN Sales.SalesOrderHeader header
on header.SalesOrderID = detail.SalesOrderID
WHERE header.SalesPersonID IS NULL
AND detail.ProductID = @ProductID;
GO
Note: IS NULL determines whether a specified expression is NULL. If the value of expression is NULL, IS NULL returns TRUE; otherwise, it returns FALSE.
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/ms188795.aspx