Home Forums SQL Server 2012 SQL Server 2012 - T-SQL What is wrong with this syntax? Query will work, but CTE will not "compile" RE: What is wrong with this syntax? Query will work, but CTE will not "compile"

  • hisakimatama (4/8/2014)

    Aha, so it doesn't :-). I've always declared CTEs with the column declarations, and by the wonderful problems of habit, it stuck as "the" way to do it. Well, I learned something that should make syntax a good bit clearer myself 😀

    Declaring the columns in a CTE is a simple way of Aliasing or overriding the Alias in the inner select, the downside is that it also prevents you from simply adding columns without also adding them to the Output List, which is a PITA in a development environment.

    _________________________________________________________________________
    SSC Guide to Posting and Best Practices