PrepAway - Latest Free Exam Questions & Answers

You need to create an inline table-valued function named Sales.fn_OrdersByTerritory

You have a view that was created by using the following code:

You need to create an inline table-valued function named Sales.fn_OrdersByTerritory.
Sales.fn_OrdersByTerritory must meet the following requirements:
Use one-part names to reference columns.
Return the columns in the same order as the order used in OrdersByTerritoryView.
Part of the correct T-SQL statement has been provided in the answer area. Provide the complete code.

PrepAway - Latest Free Exam Questions & Answers

Answer: See the explanation.

Explanation:
CREATE FUNCTION Sales.fn_OrdersByTerritory (@T int)
RETURNS TABLE
AS
RETURN
(
SELECT
OrderID,
OrderDate,
SalesTerritoryID,
TotalDue
FROM Sales.OrdersByTerritory
WHERE SalesTerritoryID=@T
)

8 Comments on “You need to create an inline table-valued function named Sales.fn_OrdersByTerritory

  1. rene says:

    CREATE FUNCTION Sales.fn_OrdersByTerritory (@T int)
    RETURNS TABLE
    AS
    RETURN
    (
    SELECT
    OrderID,
    OrderDate,
    SalesTerritoryID,
    TotalDue
    FROM Sales.OrdersByTerritory
    WHERE SalesTerritoryID=@T
    )




    0



    0
  2. Yommy O. says:

    This particular question did not ask you to specify a parameter (@T, or @any_parameter). The question also didn’t ask to filter returned rows by SalesTerritoryID; hence, there’s no need for the WHERE clause of the SELECT statement.




    1



    0

Leave a Reply