Home Forums SQL Server 2008 SQL Server Newbies Inline vs. Multi-Statement Table-Valued function, Temp Tables vs. CTEs? RE: Inline vs. Multi-Statement Table-Valued function, Temp Tables vs. CTEs?

  • Katerine459 (3/19/2015)


    GilaMonster (3/19/2015)


    Katerine459 (3/18/2015)


    Unless the CTE is also a correlated subquery, wouldn't it just run once

    And who said that a correlated subquery doesn't run just once?

    I read that here: http://www.sqlservercentral.com/articles/Stairway+Series/105972/

    This statement is wrong (and trivially provable to be wrong)

    It will be run once for each candidate row selected in the outer query.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass