Using Apostrophes and Quotation Marks with SQL WHERE ClauseLast reviewed: October 31, 1994Article ID: Q46020 |
The information in this article applies to:
SUMMARYWhen using character constants in an SQL WHERE clause, you must use a set of apostrophes or quotation marks around the string constant. If one apostrophe or quotation mark occurs within the string, make sure there is a second, matching one at the point the first one occurs. More Information: If a file is named TEST.DBF and the data is in a field named SAMPLE, the following statement selects all of the entries with SQL:
SELECT SAMPLE FROM TEST.DBFThe following statement selects those occurrences of the string that don't uses:
SELECT SAMPLE FROM TEST.DBF WHERE SAMPLE='don''t'The following statement selects those occurrences of the string that "false" uses:
SELECT SAMPLE FROM TEST.DBF WHERE SAMPLE="""false"""Note: The inner set of quotation marks are part of the string and appear in the file. Make sure to use quotation marks if the string has quotation marks in or around it. The same rule applies to apostrophes.
|
KBCategory: kbother
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |