• Sean Lange (12/9/2014)


    Alan what you posted is almost exactly what I had envisioned. I refrained from posting simply because this seems so much like homework. Let's hope the OP reads this and understands what you did.

    I was suspecting homework too ;-).

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001