Ensure SQL-92 on Access 2000 mdb to SQL Server under Access 2010

為{幸葍}努か 提交于 2019-11-29 11:55:15

In Access 2010, the setting for SQL Server Syntax compatibility is under:

File > Options > Object Designers > Query Design.

You'll first need to check if that option is set or not to confirm whether the behaviour of your query is normal.

As for LIKE vs ALIKE, the latter will work in the ANSI-way, using % and _ pattern matching.
In SQL-89 compatibility mode (the MS Access SQL subset), LIKE only works with * and ? patterns but if you change the compatibility to SQL-92, you need to rewrite your queries with % and _ instead.

That's why ALIKE was introduced, it allows you to write ANSI compliant patterns regardless of the compatibility level you choose (so in SQL-92 compatibility mode, both are behaving the same).

There is really no reason to set ANSI 92 SQL mode ON in an Access front end, except if you're a lazy SQL Server programmer who wants to forget that he's writing the SQL in Access instead of SQL Server.

The reason you don't want to do this is because it changes things in the Access application, while not actually doing anything to enhance interaction with your SQL Server back end. That is, if you use SQL 89 wildcards in your SQL in your Access front end, your ODBC driver takes care of converting to the SQL 92 wildcards when it sends the SQL to the server. The only exception would be passthrough queries, but those are written in the native SQL of your server, anyway.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!