• sqlguy-736318 (7/27/2015)


    Afaik, if I want to select rows from Student into a @MyTable table variable then I need to create the @MyTable table variable with a column structure like a normal table which is more time-consuming than using the temp table approach.

    By 'more time-consuming', you mean it'll take longer to write? Yes, but not by all that much.

    Why are you using table variables over temp tables?

    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