not in (
from tblLocation )
this query is perfact if " tblLocation.Code " and " tblLocation_Temp.Code " are same type column.
if tblLocation_Temp.Code is numaric or " tblLocation.Code " is varchar then your query have a casting problem . ' solve this by cast as varchar '
i hope this help