带有通配符的参数化查询,用于访问2003 [英] parameterized query with wildcard for access 2003
问题描述
在我的测试表中...我有Anthony Gwynn的纪录。在SQL中,通过前面提到的LIKE查询,我可以输入Ant作为第一个名称参数,并且会弹出Anthony Gwynn的记录。
到目前为止我已经试过(在设计视图中)
LIKE []
LIKE [*]
LIKE [?*]
但到目前为止,这些都没有产生任何结果。至少它问我一个参数:P
尝试参数化查询:
PARAMETERS [inputtext ] CHAR ;
SELECT *
FROM TableName
WHERE FieldName 喜欢 [inputtext]
有关详细信息,请参阅:
参数声明(Microsoft Access SQL) [ ^ ]
将参数与查询和报告结合使用 [ ^ ]
Q的技巧和技巧Access 2007中的uils [ ^ ]
找到了答案。对不起这个愚蠢的问题。
sql:LIKE'%'+ @parameter +'%'
访问:LIKE*&[大多数人似乎在提示符中显示错误:]&*
注意:
在方括号中,不要使用列标题名称,也不要忘记括号内的冒号。看起来很重要。
sorry for such a silly question. I'm trying to figure out how to write a query in access 2003 similar to the: LIKE '%'+ @parameter +'%'
in my test table...i have a record for Anthony Gwynn. In SQL, with the aforementioned LIKE query, I can type in Ant for the first name parameter and the record for Anthony Gwynn would pop up.
so far i've tried (in design view)
LIKE []
LIKE [*]
LIKE [?*]
but so far none of these have produced any results. at least it's asking me for a parameter :P
Try parametrized query:
PARAMETERS [inputtext] CHAR; SELECT * FROM TableName WHERE FieldName Like [inputtext]
For further information, please see:
PARAMETERS Declaration (Microsoft Access SQL)[^]
Using parameters with queries and reports[^]
Tips and Techniques for Queries in Access 2007[^]
figured the answer. sorry for such a silly question.
sql: LIKE '%'+ @parameter +'%'
access: LIKE "*"& [most people seem to tyep in a prompt here:] &"*"
notes:
in the square brackets, do not use a column header name and do not forget the colon inside the bracket. seem like that's important.
这篇关于带有通配符的参数化查询,用于访问2003的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!