Ver originalSELECT *FROM tutablaWHERE RIGHT(@VALOR,1) NOT IN (1,2,3)AND SUBSTRING(@VALOR,LEN(@VALOR)-1,1) IN (1,2,3)AND SUBSTRING(@VALOR,LEN(@VALOR)-2,1) IN (1,2,3)