• Not certain why you'd want to do this type of thing in SQL instead of Reporting Services or Excel (but I'm sure there's reasons ;-)) - here's a great article that will point you in the proper direction

    http://www.sqlservercentral.com/articles/Stairway+Series/87629/

    ______________________________________________________________________________Never argue with an idiot; Theyll drag you down to their level and beat you with experience