CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: SQL

  1. #1
    Join Date
    Mar 2000
    Location
    Arizona, USA
    Posts
    493

    SQL

    I am trying to execute a select statement in Access 2000. I need to know how to use
    wildcard's in the statement. I thought you used the * for a wildcard in the LIKE clause but apparently not.
    My SQL statement looks like this:
    SELECT * FROM [Table] WHERE [Table].[Field] LIKE *
    The problem is in the LIKE part of the statement. I need to know how use LIKE to find anything (wildcard) in the particular field.
    Thanks for any help!!!

    Kris
    Software Engineer
    Phoenix,AZ
    Kris
    Software Engineer
    Phoenix, AZ USA

  2. #2
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: SQL

    Try to use % instead of *
    and _ instead of ?


    SELECT * FROM [Table] WHERE [Table].[Field] LIKE 'ABC%'

    This SQL will give you everything starting with ABC

    Iouri Boutchkine
    [email protected]
    Iouri Boutchkine
    [email protected]

  3. #3
    Join Date
    Aug 2000
    Location
    England
    Posts
    185

    Re: SQL

    Hello,

    enclose the asterisk in single quotes, i.e

    SELECT * FROM [Table] WHERE [TABLE].[FIELD] LIKE '*'

    alternatively the code you have provided seems to return all the values when it works so why not use

    SELECT * FROM [TABLE]

    Hope this helps

    Andrew


Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured