Microsoft Jet's LIKE Operator: Wildcard Behavior Based on Query Mode
The Microsoft Jet database engine's LIKE
operator uses different multi-character wildcards depending on the active ANSI query mode.
ANSI-89 Query Mode (Legacy Mode)
In ANSI-89 (legacy) mode, the asterisk (*
) acts as the multi-character wildcard. This mode is generally associated with the DAO (Data Access Objects) interface.
ANSI-92 Query Mode (SQL Server Compatibility Mode)
Conversely, ANSI-92 mode (often used with ADO – ActiveX Data Objects – and the MS Access UI since version 2003) employs the percentage sign (%
) as the multi-character wildcard.
ODBC and Explicit Mode Selection
When interacting with Jet via ODBC (Open Database Connectivity), the ExtendedAnsiSQL
flag provides explicit control over the query mode, allowing you to select either ANSI-89 or ANSI-92 behavior.
The ALIKE
Keyword (Unofficial)
Microsoft Jet SQL includes the ALIKE
keyword. While it allows the use of ANSI-92 wildcards (%
and _
) regardless of the chosen query mode, it's crucial to remember that this keyword lacks official support and may not fully adhere to SQL-92 standards. Use with caution.
The above is the detailed content of How Do Wildcards Differ in Microsoft Jet's LIKE Operator Based on Query Mode?. For more information, please follow other related articles on the PHP Chinese website!