In SQL-Query Umlaute ersetzen

  • fni
  • Topic Author
  • Visitor
  • Visitor
13 years 8 months ago - 13 years 8 months ago #903 by fni
In SQL-Query Umlaute ersetzen was created by fni
Wenn man Text (varchar) - Felder in einer SQL-Abfrage gerne zur Ausgabe von eventuell enthaltenen Umlauten befreien möchte, kann man dies sehr komfortabel mit Hilfe einer Function lösen:

SELECT dbo.UserUmlErsetzen(Artikel.Kurztext) FROM Artikel
Code:
CREATE FUNCTION dbo.UserUmlErsetzen (@strText varchar(200)) RETURNS VARCHAR(500) AS BEGIN DECLARE @newText varchar(500) SET @newText = @strText SET @newText = Replace(@newText,'ä','ae') SET @newText = Replace(@newText,'Ä','Ae') SET @newText = Replace(@newText,'ü','ue') SET @newText = Replace(@newText,'Ü','Ue') SET @newText = Replace(@newText,'ö','oe') SET @newText = Replace(@newText,'Ö','Oe') SET @newText = Replace(@newText,'ß','ss') RETURN @newText END

Please Log in or Create an account to join the conversation.

Signum GmbH
Kasinostraße 2
DE-64293 Darmstadt, Germany

Tel: +49 (6151) 15 18 - 0
Fax: +49 (6151) 15 18 - 100
team@signum.info