• Hi Bryant,

    I think that in sql statements where you can use CTEs as views, there exists ways of writing the CTE as an inner join or sub query.

    Also, I tested with a few samples and saw that there is not a notiable increase in performance.

    So I meant that the real reason or necessity for a CTE is not the usage of CTE instead of a view. You are right you should not need to create a view if it will be used once. But you can not also refer to a CTE for a second time. You can use it just after the definition of the CTE.

    But even this usage is a plus and gives developers a flexiblity in their coding processes.

    And I tried to mention that the real power of a CTE is visible when it is used as a recursive common table expression.

     

    Eralper

    http://www.kodyaz.com