I have a SQL query that compares a value in the database to a constant:
SELECT * FROM my_table INNER JOIN #TempTable tem ON my_table.id = temp.id AND
try
SELECT * FROM my_table INNER JOIN #TempTable temp ON my_table.id = temp.id collate database_default AND my_table.key = 'SOME STRING'