• CELKO (12/11/2012)


    You also need to learn ANSI/ISO insertion syntax and to stop using 1970's Sybase dialect:

    Only the first part of that is true. The second part is totally not true especially when asking for help on a forum. This problem can be solved using SQL from all the way back to at least SQL Server 6.5. Since the ANSI/ISO syntax that you're talking about isn't available in SQL Server 2005 or earlier, you'll be cutting out a lot of people who might be "stuck" on a pre-2008 box that could actually help but decided not to simply because they didn't want to take the time to convert the test setup code.

    Oh, good SQL programmers do no use the proprietary PIVOT kludge.

    Although I'll certainly agree that there are sometimes better methods than PIVOT, there are a lot of excellent programmers who have realized that true portability is a myth and have elected to use all of the horsepower that SQL Server has to offer, ANSI/ISO or not. You're passive-aggressive name calling doesn't help here (or anywhere) and it diminishes your esteem as a mentor and as an SME. Please, just stop it.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)