The percent sign is analogous to the asterisk (*) wildcard character used with MS-DOS. The percent sign allows for the substitution of one or more characters in a field.
The underscore is similar to the MS-DOS wildcard question mark character. The underscore allows for the substitution of a single character in an expression. Three examples showing the use of these characters in SQL-SELECT statements are provided below. The examples use the Customer.dbf file that is included with Microsoft Visual FoxPro in the Home(2)+data folder.
SELECT * from customer WHERE Region like "W_"
SELECT * from customer WHERE Region like "_P" OR region like "_C"
Note The percent sign lets any string of characters follow the "G." Conversely, the underscore permits the substitution of only a single character.
SELECT * FROM Customer WHERE cust_ID LIKE "G%" AND region LIKE "_P"
SELECT * from customer WHERE company like "%M%"
Article ID: 98434 - Last Review: Jun 20, 2008 - Revision: 1