The point I was making is that the way you're trying to do it now, you are comparing two values, rather than making SQL Server evaluate the first as a column name; like so: ...