query  
Author Message
naveenskt





PostPosted: Tue Mar 20 15:37:30 CDT 2007 Top

SQL Server >> query

Hi

I have a following problem;

Lets say i have table with names and value in this table "håkan"

Now user enters text "hakan" for search and query must return alsow
"håkan".

Is in SQL any "special" function for this :)?
one option is create own function, but there is toooo many different options
a-ä, o-ö aso aso.



Regards;
Meelis

SQL Server33  
 
 
Russell





PostPosted: Tue Mar 20 15:37:30 CDT 2007 Top

SQL Server >> query Meelis,

This is where collations can help you. (Or hurt you.) If you were running a
Case Insensitive, Accent Insensitive collation it would do exactly what you
want. But do you always want this? Or only some of the time?

If you want to change the column definition:

ALTER TABLE MyTable
ALTER COLUMN MyAccentedColumn NVARCHAR(128)
COLLATE SQL_Latin1_General_Cp1_CI_AI

If you want to handle it in a query:

SELECT MyAccentedColumn
FROM MyTable
WHERE MyAccentedColumn COLLATE SQL_Latin1_General_Cp1_CI_AI =


Of course, you should read about how collations work before jumping into
this, so that you choose the behaviour that you desire.

RLF




> Hi
>
> I have a following problem;
>
> Lets say i have table with names and value in this table "håkan"
>
> Now user enters text "hakan" for search and query must return alsow
> "håkan".
>
> Is in SQL any "special" function for this :)?
> one option is create own function, but there is toooo many different
> options a-ä, o-ö aso aso.
>
>
>
> Regards;
> Meelis
>
>