Problem
When searching for texts containing apostrophes, no results are found.
Execution
DECLARE @cidade NVARCHAR(50)
SELECT @cidade = cidade FROM tabela_A WHERE id = xv
SELECT campo FROM tabela_B WHERE cidade = @cidade
The above example returns the result of table_A with the city OLHO D'AGUA DO AGUA , but when doing the search in table_B it does not return anything to me.
When performing the search "manually", informing cidade = "OLHO D'AGUA DO CASADO"
the result is as expected.
Attempts
Assigning the city value to a variable, I tried to use the QUOTENAME
and REPLACE
functions, but without success.