When a variable is used in a SQL, variable intersects message issue