Pass Results of a Query to a Table Type Function

  • I've started playing around with table type functions. I've got one up and running that takes a parameter and returns the expected results.

    Where do I need to go in terms of passing into the function the results of a sub query? Is it even possible? If you need more code, let me know. I specifically didn't post it because there are several layers involved.

    select * from dbo.test ('111673')

  • david.c.holley (7/14/2010)


    I've started playing around with table type functions. I've got one up and running that takes a parameter and returns the expected results.

    Where do I need to go in terms of passing into the function the results of a sub query? Is it even possible? If you need more code, let me know. I specifically didn't post it because there are several layers involved.

    select * from dbo.test ('111673')

    Found the answer after way too much Googling.

    SELECT

    SH.ShowNumber, SH.NameLong, C.*

    FROM

    ShowHeaders as SH

    OUTER APPLY Test(SH.ShowNumber) AS C;

    http://technet.microsoft.com/en-us/library/ms175156.aspx

    If you can think of any additional keywords/phrases that might help flag this post in the search engines for the next person, feel free to add them.

    Table Valued Function Parameters

    Passing Result Set into Table Value Function

    Working with Table Value Functions

    Table Value Functions Multiple Records

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply