-
-
Save carinavockell/7fb74380f610a01fad14f048aaf0409c to your computer and use it in GitHub Desktop.
For example, if I try to ALTER the inline TVF I created above, I receive the following syntax error:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR ALTER FUNCTION Sales.GetSalesByProduct | |
( | |
@ProductID INT | |
) | |
RETURNS @SalesTable TABLE | |
( | |
TotalSales MONEY | |
) | |
AS | |
BEGIN | |
INSERT INTO @SalesTable (TotalSales) | |
SELECT SUM (UnitPrice) AS TotalSales | |
FROM Sales.SalesOrderDetail | |
WHERE ProductID = @ProductID | |
GROUP BY ProductID | |
RETURN | |
END; | |
GO |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment