I would like to implement a solution where the Table-Valued-Function returns different set of data based on the value of the parameter passed to it.
For Example: something like this:
CREATE FUNCTION test(@param char(6))
RETURNS TABLE
AS
RETURN
(
IF @param IS NULL
select * from this
ELSE
select * from that
END
)