HELP ODBC sql stmt failing when using WHERE LIKE 
Author Message
 HELP ODBC sql stmt failing when using WHERE LIKE

Quote:
>2. Unless there's been an upgrade since last November, MS's ODBC
drivers
>don't support
>wildcards in LIKE.  In effect, LIKE is the same as =.  If you hear any
>differently, let me know.

This may apply only to MS Access drivers -- but I confess that I am
using Oracle's or Visigenic's ODBC driver with Oracle, which do work OK
with "WHERE LIKE" (my apps _depend_ on "WHERE LIKE").  YMMV...
==========================================================
Mark Leighton Fisher          Thomson Consumer Electronics

"Browser Torture Specialist, First Class"


Sat, 05 Aug 2000 03:00:00 GMT  
 HELP ODBC sql stmt failing when using WHERE LIKE



Quote:
> >2. Unless there's been an upgrade since last November, MS's ODBC
> drivers
> >don't support
> >wildcards in LIKE.  In effect, LIKE is the same as =.  If you hear any
> >differently, let me know.

> This may apply only to MS Access drivers -- but I confess that I am
> using Oracle's or Visigenic's ODBC driver with Oracle, which do work OK
> with "WHERE LIKE" (my apps _depend_ on "WHERE LIKE").  YMMV...

MS's Access driver (as well as other desktop drivers) have always supported
wildcards with the like condition. The trick, however, is that you must use
SQL wildcards, not Microsoft wildcards.
For some DOS-like reason Access uses the wildcards * and ? whereas SQL uses
the wildcards % and _ respectfully.

Try your query like this:

SELECT access_date, Count(*) AS Hits, Sum(Elapsed_time)/1000 AS
[TotalElapsedTime], Sum(Bytes_in) AS [TotalIn], Sum(Bytes_out) AS
[TotalOut]
FROM access_log
WHERE (Target like '%4all%')
GROUP BY access_date;

dave
--
================================================================
Dave Roth                               ...glittering prizes and
Roth Consulting                     endless compromises, shatter
rxoxtxdxxrxoxtxhx.xnXeXt               the illusion of integrity

 My email address is disguised to fool automailers. Remove the
                      X's to send me email.
****************************************************************
Use of  this message or  email address  for commercial  purposes
(including "junk" mailings) is strictly prohibited and protected
under  current  international  copyright laws  and United States
Code, Title 47, Chapter 5, Subchapter II.



Sat, 05 Aug 2000 03:00:00 GMT  
 HELP ODBC sql stmt failing when using WHERE LIKE



Quote:
> Here is the statement: SELECT access_date, Count(*) AS Hits,
> Sum(Elapsed_time)/1000 AS [Total Elapsed Time], Sum(Bytes_in) AS [Total
> In], Sum(Bytes_out) AS [Total Out FROM access_log WHERE (Target like
> "*4all*") GROUP BY access_date;

This is not a perl question. You have your SQL wrong. Read a primer on
SQL syntax.

Martien

Hint: SQL wildcards are % and _

--
Martien Verbruggen                  |
Webmaster www.tradingpost.com.au    | That's not a lie, it's a terminological
Commercial Dynamics Pty. Ltd.       | inexactitude.
NSW, Australia                      |



Sat, 05 Aug 2000 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. LONG: Req: Help in retrieving values from SQL Server stored procedure using Win32::ODBC

2. DBD::ODBC::db prepare failed: [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name 'tblClient'. (SQL-S0002)

3. looping through an sql query using win32::odbc

4. Connecting to SQL Server through ODBC using Perl

5. SQL error 170 using Win32::ODBC

6. Connecting to SQL Server through ODBC using Perl

7. looping through an sql query using win32::odbc

8. SQL using the ODBC module

9. Win32::ODBC SQL and using date

10. Win32::ODBC, Perl SQL vs. standard SQL

11. HELP: Innocuous return stmt yields errors

12. Help with interactive SQL using PERL

 

 
Powered by phpBB® Forum Software