• Eirikur Eiriksson (8/2/2014)


    Daniel Matthee (8/2/2014)


    Eirikur Eiriksson (8/2/2014)


    CONVERT(INT,P.[20140728]) + CONVERT(INT,P.[20140804])

    Hi Eirikur

    I dont fully agree that it has the same flexibility.

    For example in my suggestion i can create any date range as a integer presentation and it will automatically add up all values that are valid.

    Where in your example this is a manual process.

    Dont get me wrong yours will still work. But i find my solution more dynamic and flexible.

    I however do agree that any changes to the table structure will increase the complexity of the Pivot where your solution only will need more converts

    🙂

    Hope this makes sense?

    Of course it makes lot more sense than the given table structure. What I meant was that if the structure changes, the query needs to change. Applications utilizing such a structure often append or inject new columns and for your query and my later sample, game over:blush:

    Both our queries are converting sysname to datetime, no difference there though.

    😎

    Fully agreed

    😀

    --------------------------------------------------------------------------------------------------------------------------------------------------------
    To some it may look best but to others it might be the worst, but then again to some it might be the worst but to others the best.
    http://www.sql-sa.co.za