• Good read, Steve.   Quick, clean, accurate, and on point.

    One thing worth mentioning when using APPLY with a table valued function is the difference between CROSS APPLY and OUTER APPLY.

    When CROSS apply is used, no row is returned from a query unless the function actually returns a row (even if the row only contains a NULL).   This is analogous to an INNER JOIN.

    When OUTER apply is used,  rows are returned even if the function itself returns nothing.   This is analogous to a LEFT JOIN.

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills