|
Execute the following
script in Query Editor to create the extra space removal function:
USE AdventureWorks;
CREATE FUNCTION fnRemoveMultipleSpaces(@InputString
varchar(1024))
RETURNS varchar(1024)
AS
BEGIN
WHILE CHARINDEX(' ', @InputString) > 0
SET @InputString = REPLACE(@InputString, ' ', ' ') -- replace
2 spaces with 1 space
RETURN @InputString
END
-- SELECT dbo.fnRemoveMultipleSpaces ('The fox
ran in the forest!')
|