Created
January 2, 2018 17:11
-
-
Save codenamejason/eab7f3ce239b527ee6ab2230c192713b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE FUNCTION [dbo].[fnRemoveSpaces]( | |
@string_text VARCHAR(MAX), | |
@threshold int = 3 | |
) | |
RETURNS VARCHAR(MAX) | |
AS | |
BEGIN | |
DECLARE @tempText AS VARCHAR(MAX) | |
SET @tempText = replace(@string_text, char(10), ' ') | |
SET @tempText = replace(@string_text, char(13), ' ') | |
WHILE CHARINDEX(SPACE(@threshold),@tempText) > 0 | |
BEGIN | |
SET @tempText = REPLACE(@tempText, SPACE(@threshold), ' ') | |
END | |
RETURN @tempText |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment