The task at hand involves counting the number of occurrences of a substring (@substr) within an input string ... of multiple contiguous spaces with one space. Peter Larsson, a SQL Server MVP, came up with a beautiful technique to handle this task.
↧