CREATE FUNCTION ufDiscontinuedProductRowsInCategory( @CategoryID int) RETURNS table AS RETURN( SELECT nc.CategoryID, nc.CategoryName, np.ProductName FROM Northwind.dbo.Categories AS nc, Northwind.dbo.Products AS np WHERE nc.CategoryID = np.CategoryID AND np.Discontinued = 1 AND np.CategoryID = @CategoryID)