我在SQL中使用用户变量检索字符有一个小问题查询如下
DECLARE @search
SET @search='chicken'
SELECT * from Recipes where TITLE like '@search'
它是否正确?它应该检索标题包含提供给@search 的单词的食谱。
我什至尝试给予
SELECT * from Recipes where TITLE IN ('+@search+')
SELECT * from Recipes where TITLE =@search
SELECT * from Recipes where TITLE =$[@search]
但似乎没有一个工作。
提前致谢