I am trying to assign a value to a a user-defined variable like this:
SET @v1='name_to_filter';
SELECT *
FROM mytable
WHERE column=@v1;
The problem is that this code returns 0 rows, but if instead of declare this variable I put the name to filter in the where close the code returns a few rows:
SELECT *
FROM mytable
WHERE column='name_to_filter';
So the variable is not saving the name I asigned to it, what am I doing wrong?