sdownen05 (10/31/2011)
Lynn,Thank you very much for the code, and also for correcting what I had sent. This works fine except for one thing; I get this message when I run it:
Msg 536, Level 16, State 3, Line 1
Invalid length parameter passed to the substring function.
When I take out the '- 1' it works fine, but obviously gives me more everything.
Must be a data issue. I don't get that error with the data you provided. You should check the data in your table to see if there is something not accounted for in the sample data.