“For any input string, return a string that has an additional space between each two characters, even when one of the input characters is itself a space”
DECLARE @string VARCHAR(100)
DECLARE @result VARCHAR(100)
SET @String = ‘hello world’;
WITH n AS (
SELECT TOP (LEN(@string)) ROW_NUMBER() OVER(ORDER BY [object_id]) x
SELECT @result = CAST(
(SELECT SUBSTRING(@string, x, 1) [text()], ‘ ‘
FOR XML PATH(”), TYPE) AS varchar)
I would like to have feedback from my blog readers.
Please post your feedback, question, or comments about this article.