test (10/22/2009)
Wow, that's complex! - Thanks
You're welcome, Test. Just make that code a user-defined function and the complexity goes away.
Better yet, make it an inline table-valued function. (Slightly more complex, but performs better for large batches).
Create a permanent tally table, and some of the complexity of the code goes away. All it really does is get a list of the positions that have spaces and uses the position of the fifth space as the ending position of the substring.
Let me know if you have any questions.
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills