背景:
我有一个 Access 2007 应用程序,其中的表单构建了一个过滤器字符串以传递给一个报表,该报表使用一个存储的查询。在 Access 选项中,我为此数据库选中了“SQL Server 兼容语法 (ANSI 92)”,并且筛选字符串包含带有 % 通配符的 LIKE 子句。问题:
当我保存或打开应用程序时(不确定确切原因),有效的通配符语法会随机从需要 % 切换到 *,或返回。我知道这一点是因为我的查询停止工作。
我尝试过的:
我对通配符进行查找/替换,它会工作一段时间,然后又会再次发生,而无需对查询或过滤器进行任何重大更改。大量的紧凑/维修并没有带来任何影响。有什么想法吗?
BACKGROUND:
I have an Access 2007 application, with a form which builds a Filter string to pass to a Report, which uses a stored query.In Access Options, I have "SQL Server Compatible Syntax (ANSI 92)" checked for This database, and the Filter string includes a LIKE clause with % wildcard characters.ISSUE:
Randomly when I save or open the application (not sure the exact cause), the effective wildcard syntax switches from needing % to *, or back. I know this because my query stops working.
WHAT I'VE TRIED:
I do a find/replace on the wildcard characters, it works for a while, and then it happens all over again, without making any significant changes to the query or filter.Plenty of Compact/Repairs have made no difference.Any ideas?
发布评论
评论(1)
如果您仅使用 ANSI-92 查询模式作为替代通配符字符(而不是它提供的增强的 SQL DDL 和 DCL SQL 语法),然后考虑使用
ALIKE
关键字代替LIKE
关键字。优点是您可以在任一查询模式中使用 ANSI-92 查询模式通配符。略微的缺点是 ALIKE 不受官方支持,这意味着它可能会在引擎的未来版本中消失(尽管我自己将其评为低风险)。
If you are only using ANSI-92 Query Mode for the alternative wildcard characters (rather than the enhanced SQL DDL and DCL SQL syntax it offers) then consider using the
ALIKE
keyword in place of theLIKE
keyword.The advantage is that you can use the ANSI-92 Query Mode wildcard characters in either Query Mode. The slight disadvantage is that the
ALIKE
is officially unsupported, meaning it might disappear in a future release of the engine (though I would rate this as low risk myself).