How to perform a search disregarding Firebird special characters in the WHERE Clause

Asked

Viewed 697 times

0

I’m making a View and Clause WHERE it does not accept a filter of this 'Temporary' only if removing the accent Ex: 'Temporario'.

CREATE VIEW VWORDEMPRODUCAO (
CODEMPRESA
)
AS
SELECT
F002 AS CODEMPRESA
FROM MFT05O020
WHERE F020 <> 'Temporário'

Thank you and I’ll be waiting.

  • Is there a mistake? If so, which?

1 answer

0

I’m not familiar with Firebird, so I’m not sure if this solution is viable, but it’s worth:

CREATE VIEW VWORDEMPRODUCAO (CODEMPRESA)
AS
    SELECT  F002 AS CODEMPRESA
    FROM    MFT05O020
    WHERE   (CAST(F020 AS VARCHAR(MAX)) COLLATE SQL_Latin1_General_Cp1251_CS_AS) <> ('Temporário' COLLATE SQL_Latin1_General_Cp1251_CS_AS)

To Collation Sql_latin1_general_cp1251_cs_as removes all accented characters, thus allowing comparison without them.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.