General |
6.6 Finding a String Containing an Asterisk Using the SQL where. |
Jeff B. Ogle, J & S Consulting of Phoenix, Arizona US. |
Editor's Note: Use the chr$ function. ASCII 42 = * An example of your Where clause would be: Where ShipCountry = Chr$(42) Take a look at this interesting problem. Using this example as a reference for discussion, from the NWind.mdb example supplied with Access97. Assuming an Asterisk in ShipCountry "SELECT * FROM Orders WHERE [ShipCountry] = '*'" If data in ShipCountry field contained an Asterisk, in the QBE for the SQL what is the criteria or filter to search for an asterisk. Remember an asterisk is used with a Like operator to find values in a field that match the pattern you specify. I have tried all the methods recommended by Microsoft Access 97 Help to detect an asterisk and failed. The correct SQL statement is: "SELECT * FROM Orders WHERE [ShipCountry] Like "*[*]*" Please note that you need to enter Like "*[*]*" as the Criteria in the QBE. You can search for Question Mark by entering Like "*[?]*" as the Criteria in the QBE. Why would anyone use an "*" or "?" as data. All I can say is ? |