Skip to content

Instantly share code, notes, and snippets.

@carinavockell
Created September 12, 2022 16:22
Show Gist options
  • Save carinavockell/7fb74380f610a01fad14f048aaf0409c to your computer and use it in GitHub Desktop.
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:
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