In Microsoft SQL Server 2000 or higher, developers can create a user-defined function that returns a table. Such functions are useful for performing complex or procedural logic. Developers can write a query that uses the fn_GetSomeData function as a source of data. The resulting SQL might look like this:

SELECT *

FROM

fn_GetSomeData (‘JKL12345YH’)