/ Published in: SQL
![](/img/icon_sav.png?v3)
Removes extra spaces from a string in SQL Server.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
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
Comments
![RSS Feed for Comments RSS Icon](/images/rss.png?v3)