I'm doing a query through a value stored in a variable. This variable is declared DECLARE @it_codigo varchar(max)
and gets value of a ntext
field from another table, through a procedure.
SELECT * FROM anaProdutos WHERE cod_produto LIKE '' + @it_codigo + ''
I also tried to use the QUOTENAMES
function and still does not insert the apostrophes.