DSM

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • Sybase LIKE clause underscore wildcard problem

    0 answers - 2244 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    Hello Torque Users/Developers,
    Greetings!
    I have a workable system with MySQL 4.1 as a database and using Torque
    3.2. Everything works fine there. I am trying to port the system to a
    Sybase 12.5 database.
    In one of my module I have a query formed as shown below:
    SELECT * FRM CSFieldRegistry
    WHERE CSFieldRegistry.Name LIKE 'CSCLIENT\_%'
    AND CSFieldRegistry.CustomField=1
    AND CSFieldRegistry.Active=1
    AND CSFieldRegistry.Editable=1
    AND
    Please observe the LIKE clause in the above query. It works fine on
    MySQL as MySQL knows that a backslash (\) is an escape sequence for the
    underscore (_)
    But the query fails on Sybase as Sybase expects the query in the
    following form.
    SELECT * FRM CSFieldRegistry
    WHERE CSFieldRegistry.Name LIKE 'CSCLIENT\_%' escape '\'
    AND CSFieldRegistry.CustomField=1
    AND CSFieldRegistry.Active=1
    AND CSFieldRegistry.Editable=1
    AND
    Please observe the LIKE clause. It needs to suffix it with an escape '\'
    keyword.
    It becomes a little difficult to have a approach which will work on both
    the databases. Sybase expects ESCAPE and MySQL works fine with a
    backslash '\.'
    Sybase will not treat '\' as a default escape sequence whereas MySQL
    will.
    It would be of great help if you could guide me with a
    resolution/approach which will make the query work on both the databases
    (MySQL and Sybase)
    Thanks for your help.
    Cheers,
    Umesh
    Umesh Wagle * Module Lead * SunGard services (India), Meridian
    Plaza,Sr.No. 108/8/1 + 2/1, S.B. Road, Pune - 411053, India
    Direct Tel : +91-20-25606197 * Main Tel.: +91-20-25606000 *
    Fax.:+91-20-25606222 * umesh.wagle (AT) SS (DOT) SunGard.com * www.sungard.com
    <http://www.sungard.com/
    CNFIDENTIALITY: This email (including any attachments) may contain
    confidential, proprietary and privileged information, and unauthorized
    disclosure or use is prohibited. If you received this email in error,
    please notify the sender and delete this email from your system. Thank
    you.

Re: Sybase LIKE clause underscore wildcard problem


max 4000 letters.
Your nickname that display:
In order to stop the spam: 4 + 3 =
QUESTION ON "DSM"

EMSDN.COM