Return to Snippet

Revision: 61577
at December 21, 2012 23:08 by jprochazka


Initial Code
CREATE FUNCTION [dbo].[RemoveSpaces] (@Str VARCHAR(MAX))
RETURNS VARCHAR(MAX)
AS
BEGIN
        SET @str = REPLACE(@str,' ','{}')
        SET @str = REPLACE(@str,'}{','')
        SET @str = REPLACE(@str,'{}',' ')
        RETURN @str
END

Initial URL

                                

Initial Description
Removes extra spaces from a string in SQL Server.

Initial Title
SQL Server: Remove extra spaces from a string.

Initial Tags

                                

Initial Language
SQL