concept inline table in category sql
appears as: Inline table

This is an excerpt from Manning's book SQL Server MVP Deep Dives Vol. 2.
Listing 5. Inline table valued function
CREATE FUNCTION dbo.fn_TotalPrice_TVF (@SalesOrderID int) RETURNS TABLE WITH SCHEMABINDING AS RETURN SELECT SUM((UnitPrice - UnitPriceDiscount) * OrderQty) AS TotalPrice FROM Sales.SalesOrderDetail WHERE SalesOrderID = @SalesOrderID GO CREATE PROC dbo.TVFsAreBetter AS SET NOCOUNT ON SELECT t.Name as TerritoryName, oh.OrderDate, fn.TotalPrice FROM Sales.SalesOrderHeader oh INNER JOIN Sales.SalesTerritory t ON t.TerritoryID = oh.TerritoryID CROSS APPLY dbo.fn_TotalPrice_TVF(oh.SalesOrderID) as fn WHERE fn.TotalPrice > 10000 GO EXEC dbo.TVFsAreBetter