Results 1 to 2 of 2
  1. #1
    Join Date
    May 2010
    Posts
    52

    Unanswered: with clluse vs temp table

    hi there fellow SQL Devs/Admins i have a question. is there a significant difference of using the WITH statement rather than a Temp Table besides less typing. l

  2. #2
    Join Date
    Jan 2013
    Posts
    354
    Provided Answers: 1
    Yes. WITH is a shorthand for a subquery. It is part of a query and does not have to write to a disk. It is also portable; the T-SQL temp table model is not ANSI! It is 1970's sybase/UNIX.

    In higher SQL products, the optimizers will decide to materialize the CTE and to share it among sessions. They can also do this with temp tables, but they are required to do it no matter what.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •