larsbloch
10/1/2018 - 10:30 AM

function Remove Danish Letters

Remove danish letters from value

CREATE FUNCTION [dbo].[fnRemoveDanishLetters](@text nvarchar(4000))  
RETURNS nvarchar(4000)  
AS   
BEGIN
	--Check input number for illegal characters
	IF @text is null RETURN null
	--IF @text LIKE '%æÆøØåÅ%' RETURN 'Xillegal char'
	SET @text = REPLACE(@text, 'æ', '')
	SET @text = REPLACE(@text, 'Æ', '')
	SET @text = REPLACE(@text, 'ø', '')
	SET @text = REPLACE(@text, 'Ø', '')
	SET @text = REPLACE(@text, 'å', '')
	SET @text = REPLACE(@text, 'Å', '')
	return @text
END