Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 387
  • Last Modified:

Greek Query part 2

In my table an ntext field contains mixed language data, english, german and greek.

Running a query with greek like

select engelszoektekst from lemma where engelszoektekst like N'% ***greek with diacritics here*** %'

works just fine.

If I replace characters with diacritics by basic characters (i.e. alpha for all alpha variants) i get no result. Using accent insensitive colation like

select engelszoektekst from lemma where engelszoektekst like N'% ***greek without diacritics here*** %' collate SQL_Latin1_General_Cp1253_CI_AI does not help.

Any ideas?



0
pietjepuk
Asked:
pietjepuk
  • 2
1 Solution
 
pietjepukAuthor Commented:
in ASP, you can use this function :

Public Function removeAccent(source)
    avantConversion = "àÀâÂäÄáÁéÉèÈêÊëËìÌîÎïÏòÒôÔöÖùÙûÛüÜçÇ’ñ"
    apresConversion = "aAaAaAaAeEeEeEeEiIiIiIoOoOoOuUuUuUcC'n"

    temp = source
    For boucle = 1 To Len(avantConversion)
        temp = Replace(temp, Mid(avantConversion, boucle, 1),
Mid(apresConversion, boucle, 1))
    Next
    temp = Replace(temp, "œ", "oe")

    removeAccent = temp
End Function

You can create this function directly in sql server like this :

CREATE FUNCTION replaceAccentChar (@source as varchar(255))
RETURNS varchar(255) AS
BEGIN

declare @charList as varchar(20)
declare @temp as varchar(255)
declare @t as int

set @temp = @source
set @charList = 'aeioucn'

set @t = 0
while @t <= len(@charList)
begin
    set @temp = replace(@temp, substring(@charList, @t, 1),
substring(@charList, @t, 1))
    set @t = @t + 1
end
set @temp = Replace(@temp, 'œ', 'oe')
set @temp = Replace(@temp, '’', '''')

return @temp

END
0
 
moduloCommented:
Closed, 500 points refunded.

modulo
Community Support Moderator
Experts Exchange
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now