set ANSI_NULLS ON set QUOTED_IDENTIFIER ON go -- ============================================= -- Author: Raffo -- Create date: 18 oct 2006 -- Description: cleans bad chars from patstat -- ============================================= ALTER FUNCTION [dbo].[cleanchar] (@dirtystring varchar(255)) RETURNS varchar(255) AS BEGIN DECLARE @tempstring as varchar(255) SELECT @tempstring=replace(@dirtystring,'Ç',' ') SELECT @tempstring=replace(@tempstring,'ì',' ') SELECT @tempstring=replace(@tempstring,'º',' ') SELECT @tempstring=replace(@tempstring,'Á','A') SELECT @tempstring=replace(@tempstring,'á','a') SELECT @tempstring=replace(@tempstring,'à','a') SELECT @tempstring=replace(@tempstring,'â','a') SELECT @tempstring=replace(@tempstring,'Ä','AE') SELECT @tempstring=replace(@tempstring,'«','AE') SELECT @tempstring=replace(@tempstring,'ä','ae') SELECT @tempstring=replace(@tempstring,'ã','a') SELECT @tempstring=replace(@tempstring,'å','a') SELECT @tempstring=replace(@tempstring,'Õ','a') SELECT @tempstring=replace(@tempstring,'Å','A') SELECT @tempstring=replace(@tempstring,'æ','ae') SELECT @tempstring=replace(@tempstring,'µ','ae') SELECT @tempstring=replace(@tempstring,'×','C') SELECT @tempstring=replace(@tempstring,'ç','c') SELECT @tempstring=replace(@tempstring,'?','E') SELECT @tempstring=replace(@tempstring,'ñ','E') SELECT @tempstring=replace(@tempstring,'é','e') SELECT @tempstring=replace(@tempstring,'è','e') SELECT @tempstring=replace(@tempstring,'ê','e') SELECT @tempstring=replace(@tempstring,'Ë','E') SELECT @tempstring=replace(@tempstring,'ë','e') SELECT @tempstring=replace(@tempstring,'¢','e') SELECT @tempstring=replace(@tempstring,'í','i') SELECT @tempstring=replace(@tempstring,'î','i') SELECT @tempstring=replace(@tempstring,'ï','i') SELECT @tempstring=replace(@tempstring,'¾','o') SELECT @tempstring=replace(@tempstring,'ó','o') SELECT @tempstring=replace(@tempstring,'ò','o') SELECT @tempstring=replace(@tempstring,'ô','o') SELECT @tempstring=replace(@tempstring,'Í','OE') SELECT @tempstring=replace(@tempstring,'Ö','OE') SELECT @tempstring=replace(@tempstring,'ö','oe') SELECT @tempstring=replace(@tempstring,'÷','oe') SELECT @tempstring=replace(@tempstring,'Ô','O') SELECT @tempstring=replace(@tempstring,'ø','o') SELECT @tempstring=replace(@tempstring,'Ø','O') SELECT @tempstring=replace(@tempstring,'Ó','O') SELECT @tempstring=replace(@tempstring,'ß','ss') SELECT @tempstring=replace(@tempstring,'·','u') SELECT @tempstring=replace(@tempstring,'ú','u') SELECT @tempstring=replace(@tempstring,'û','u') SELECT @tempstring=replace(@tempstring,'¨','U') SELECT @tempstring=replace(@tempstring,'©','U') SELECT @tempstring=replace(@tempstring,'ü','u') SELECT @tempstring=replace(@tempstring,'³','u') SELECT @tempstring=replace(@tempstring,'Ü','U') SELECT @tempstring=replace(@tempstring,'ÿ','y') SELECT @tempstring=replace(@tempstring,',¹',' ') SELECT @tempstring=replace(@tempstring,',¹',' ') SELECT @tempstring=replace(@tempstring,'­','E') SELECT @tempstring=replace(@tempstring,'Ð','') SELECT @tempstring=replace(@tempstring,' ','') SELECT @tempstring=replace(@tempstring,'¿','') SELECT @tempstring=replace(@tempstring,'Ñ','N') SELECT @tempstring=replace(@tempstring,'Â','A') SELECT @tempstring=replace(@tempstring,'±','') SELECT @tempstring=replace(@tempstring,'¤','') SELECT @tempstring=replace(@tempstring,'§',' ') SELECT @tempstring=replace(@tempstring,'¬','') SELECT @tempstring=replace(@tempstring,'ð','') SELECT @tempstring=replace(@tempstring,'õ','o') SELECT @tempstring=replace(@tempstring,'É','') SELECT @tempstring=replace(@tempstring,'¼','') SELECT @tempstring=replace(@tempstring,'½','A') SELECT @tempstring=replace(@tempstring,'ý','') SELECT @tempstring=replace(@tempstring,'¹',' ') SELECT @tempstring=replace(@tempstring,'Þ',' ') SELECT @tempstring=replace(@tempstring,'Ý','o') SELECT @tempstring=replace(@tempstring,'´','') SELECT @tempstring=replace(@tempstring,'®','o') SELECT @tempstring=replace(@tempstring,'°','o') SELECT @tempstring=replace(@tempstring,'ù','') SELECT @tempstring=replace(@tempstring,'²','O') SELECT @tempstring=replace(@tempstring,'Ú','e') SELECT @tempstring=rtrim(ltrim(@tempstring)) RETURN @tempstring END