Trying to UnPivot without using multiple selects unioned together

  • Wow... I wander off and enjoy the PASS Summit and come back to find this !? Why don't one of you guys take this opportunity to write a "Beyond Unpivot" article?

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • Hey Bob,

    I think we pretty much did already 😉

    Glad you enjoyed PASS.

    Paul

  • I'll say you did. The end result is sweet, too.

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • Hey Paul, I revisited this and noticed that your last post replaced the cross apply of a VALUES clause with a subquery containing a lot of SELECT/UNION all statements. I'm assuming this was for performance reasons, but could you elaborate?

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • The Dixie Flatline (9/23/2010)


    Hey Paul, I revisited this and noticed that your last post replaced the cross apply of a VALUES clause with a subquery containing a lot of SELECT/UNION all statements. I'm assuming this was for performance reasons, but could you elaborate?

    No, there's no difference - I just wanted the final query to be compatible with SQL Server versions prior to 2008.

  • Understood. Thanks for taking the time.

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

Viewing 6 posts - 46 through 50 (of 50 total)

You must be logged in to reply to this topic. Login to reply