Look again. The variable used by Madhivanan is a VARCHAR(MAX) which will hold up to a binary 2 billion characters, which is a tidu sum more than a mere 8,000.
If you are stuck in SQL Server 2000 or less, then it is very likely that you will have to use a loop. In this case, the loop is used as a control device and, considering the MS wrote their original code as a cursor on steroids, it would probably be OK if you used a loop for this in SQL Server 2000 or less or if you had more than 2 billion characters of code as a result of the self concatenation that Madhivanan used.
commented on Jun 11 2013 10:28PM