Results 1 to 3 of 3

Thread: SQL Like <-- How is this possible ?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 1999
    Posts
    309
    When i use this SQL string I get 2 records returned:

    SELECT PlaatsID, Name FROM Loc WHERE PlaatsID Like 'E_%';

    When i use this SQL string i get nothing:

    SELECT PlaatsID, Name FROM Loc WHERE PlaatsID Like 'E_*';

    I don't get it...

    I use this to do the databse communication:

    Set objConn = server.CreateObject("ADODB.Connection")
    Set objRS = server.CreateObject("ADODB.Recordset")


    strSQL = "SELECT PlaatsID, BladzijdeID FROM Bladzijden WHERE PlaatsID Like 'E_%'"

    objConn.Open strConnect
    objRS.Open strSQL,objConn,3,1,1

  2. #2
    Fanatic Member Jerry Grant's Avatar
    Join Date
    Jul 2000
    Location
    Dorset, UK
    Posts
    810
    The wild card in your 'WHERE' clause of the statement needs to be '*' for Access databases, and '%' for SQL Server databases.

    You could use a consatant in your SQL statement to represent the wildcard, so that if you connect to a different database, then you only need to change it once.
    Jerry Grant................tnarG yrreJ
    Website: <JG-Design></.net>
    Email: [email protected]
    Working towards a bug free world......
    (Not a Microsoft employee)

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 1999
    Posts
    309
    I was under the impression that "%" was a wildcard for 1 character and that "*" was a wildcard for x characters

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