Replacing multiple spaces with a single space is an old problem that people use loops, functions, and/or Tally tables for. Here's a set based method from MVP Jeff Moden.
2012-08-17 (first published: 2009-11-16)
65,040 reads
Returns the First or last day date of the month for a given date.
2009-12-01 (first published: 2009-11-11)
2,857 reads
get a list of syscolumns names from string comma separated columns list
2023-07-18 (first published: 2009-11-11)
860 reads
Generate stored procedure parameter list based on table, useful when creating new SPs on tables with lots of columns.
2009-12-04 (first published: 2009-11-10)
2,012 reads
Revisiting his very popular article on the running total and ordinal rank problems, MVP Jeff Moden brings us a detailed analysis of how you might want to implement a solution in T-SQL.
2019-05-22 (first published: 2009-11-10)
48,099 reads
Find the first available drive letter (working backwards from z)
2009-11-17 (first published: 2009-11-06)
1,005 reads