I have a function that includes:
SELECT @pString = CAST(@pString AS VARCHAR(255)) COLLATE SQL_Latin1_General_Cp1251_CS_AS
This is useful, for example, to remove accents in French; eg:
UPPER(CAST('Éléctricité' AS VARCHAR(255)) COLLATE SQL_Latin1_General_Cp1251_CS_AS)
gives ELECTRICITE .
But using COLLATE makes the function non-deterministic and therefore I cannot use it as a computed persistent value in a column.
Q1. Is there another (quick and easy) way to remove such accents with a deterministic function?
Q2. (Bonus question) The reason I am doing this calculated thrust column is the search. For example, a user can enter the customer’s name as “Gagne” or “Gagné” or “GAGNE” or “GAGNÉ” and the application will find it using a constant computed column. Is there a better way to do this?
EDIT: Using SQL Server 2012 and SQL-Azure.
source share