Thread

  1. Doing case-insensitive queries.

    Dana M. Epp <eppdm@netmaster.ca> — 1998-05-26T17:24:34Z

    I am trying to query a database case-insenstively on a char() field, and
    failing miserably. Could anyone direct me to some documentation that
    properly explains how to accomplish such a task in PostgreSQL.
    
    Items like ~* don't work when using the LIKE for me.
    
    Here is my current code segment on how I am doing this query with case
    sensitivity.
    
    
       $qstring = "select * from $database where vendor LIKE
    \'\%$inqstring\%\' ; "; 
    
       $result = $con->exec($qstring);
    
    Can anyone tell me how I could query that without case-sensitivity?
    
    -- 
    Dana M. Epp
    eppdm@netmaster.ca
    
    NetMaster Networking Solutions, Inc.
    http://www.netmaster.ca
    
    "Connecting networks to the Internet"
    
    
  2. Re: [SQL] Doing case-insensitive queries.

    Marc G. Fournier <scrappy@hub.org> — 1998-05-26T17:34:33Z

    On Tue, 26 May 1998, Dana M. Epp wrote:
    
    > I am trying to query a database case-insenstively on a char() field, and
    > failing miserably. Could anyone direct me to some documentation that
    > properly explains how to accomplish such a task in PostgreSQL.
    > 
    > Items like ~* don't work when using the LIKE for me.
    > 
    > Here is my current code segment on how I am doing this query with case
    > sensitivity.
    > 
    > 
    >    $qstring = "select * from $database where vendor LIKE
    > \'\%$inqstring\%\' ; "; 
    > 
    >    $result = $con->exec($qstring);
    > 
    > Can anyone tell me how I could query that without case-sensitivity?
    
    select * from $database where vendor *~ '$inqstring';
    
    	I might have that *~ backwards...if that fails, try ~* :(