I make a query, to know the Id of a specific table whose value I keep in a variable, this always gives me zero and is incorrect, since that value is in that table.
set @provi = (select Id From Provincia Where Nombre = _provincia);
I make a query, to know the Id of a specific table whose value I keep in a variable, this always gives me zero and is incorrect, since that value is in that table.
set @provi = (select Id From Provincia Where Nombre = _provincia);
Try it like this:
Select Id Into @provi From Provincia Where Nombre = _provincia;