ScottPletcher (8/25/2016)
Rather than literal strings of spaces, I recommend using SPACE(), just for readability:
/*CREATE FUNCTION ...*/
SELECT REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(LTRIM(RTRIM(@Text)),
SPACE(33), ' '),
SPACE(17), ' '),
SPACE(9), ' '),
SPACE(5), ' '),
SPACE(3), ' '),
SPACE(2), ' '),
SPACE(2), ' ') AS NewText
+1
Excuse me, I need to go re-write some code.
-- Itzik Ben-Gan 2001