Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2005
    Posts
    13

    Unanswered: LIKE clause in SQL

    This one makes no sense to me. I'm using Access 97 as a front-end and SQL Server 8.0 as a backend. The following query on the SQL Server evaluates like it should. Put it in the Access environment, and I get no records returned. Any ideas ? Everywhere I've read says that % is the delimiter you use for LIKE for SQL Server for > 1 character.

    SELECT Employee, UserLevel FROM tblEmployees
    WHERE UserLevel Like '%MA%' AND LoginName='SOMEONE';

    (I'm looking for the presence of "MA" anywhere in the field UserLevel.

  2. #2
    Join Date
    Mar 2004
    Location
    Berlin, Germany
    Posts
    107
    within access replace the '%' with the '*'

  3. #3
    Join Date
    Mar 2005
    Posts
    13
    Worked - THANKS SO MUCH ! What do I do for dates in access (if the query is against the SQL database) ?

  4. #4
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Here we go again ... BOTH the "*" and the "%" work in Access. The "*" works when using a query built with and saved by the QBE ... The "%" works with SQL statements generated within VBA code in your DAO or ADO connections ( and recordsets also) ...
    Back to Access ... ADO is not the way to go for speed ...

  5. #5
    Join Date
    Mar 2004
    Location
    Berlin, Germany
    Posts
    107
    enclose a date with '#' in access if you write sql directly (within qbe dates are automatically amended with the '#') if you use linked tables it's no problem. i don't know what's the case when you use Pass Through's

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •