Re: SQL query fails
From: MGFoster (me_at_privacy.com)
Date: 08/02/04
- Next message: John Vinson: "Re: calculating problem"
- Previous message: Joe Stanton: "SQL query fails"
- In reply to: Joe Stanton: "SQL query fails"
- Next in thread: Joe Stanton: "Re: SQL query fails"
- Reply: Joe Stanton: "Re: SQL query fails"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 02 Aug 2004 18:37:19 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
You can't use the same wild card character in all db engines. The "one
or more characters" wild card character in MS SQL & Oracle is the
ampersand (&); Access (JET) uses the asterisk (*). The "any one
character" wild card in MS SQL & Oracle is the underline (_); Access
(JET) uses the question-mark (?).
-- MGFoster:::mgf00 <at> earthlink <decimal-point> net Oakland, CA (USA) -----BEGIN PGP SIGNATURE----- Version: PGP for Personal Privacy 5.0 Charset: noconv iQA/AwUBQQ6J1oechKqOuFEgEQJO+wCg0CS3xN5VK7CIchd1L0SIbMaz3K0AoPm1 oi27wjYZCoy8XKU0+AekmyO3 =fAcx -----END PGP SIGNATURE----- Joe Stanton wrote: > Hello Group > > I have a query that works in Oracle and SQL Server, but fails in Microsoft > Access. > > The query is: > > SELECT data fromTABLE1 WHERE data>='A&' AND data<'A''' > > Here is my sample data: > > TABLE1.DATA > Row1 A&M Stores > Row2 A&P Grocery > Row3 Assoc. Foods > > Under Oracle and SQL Server the rows that are returned are Rows 1 and 2. > Under Access no rows are returned. > > The goal is to write a SQL statement that works on all 3 platforms without > creating a customized query for each platform (or actually custom just for > Access). Please note that I know how to write a query that would work in > Access, but that query would use the InStr function which is not universally > available. > > It is my theory that when Access (or Jet) executes the query it internally > executes the query as a LIKE type expression, and seeing that there are > special characters in the literal string this causes the query to return no > rows.
- Next message: John Vinson: "Re: calculating problem"
- Previous message: Joe Stanton: "SQL query fails"
- In reply to: Joe Stanton: "SQL query fails"
- Next in thread: Joe Stanton: "Re: SQL query fails"
- Reply: Joe Stanton: "Re: SQL query fails"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|