如果您应该使用 LIKE 或 ‘=’ 来比较 SQL 语句中的字符串,则存在(几乎是宗教性的)讨论。
要查看性能差异,请尝试以下操作:
SELECT count(*) FROM master..sysobjects as A JOIN tempdb..sysobjects as B on A.name = B.name SELECT count(*) FROM master..sysobjects as A JOIN tempdb..sysobjects as B on A.name LIKE B.name
用 ‘=’ 比较字符串要快得多。