• newbieuser (5/10/2011)


    I tried the sql using openquery but I'm not getting it right..

    SELECT * from OPENQUERY(LS, 'SELECT * FROM U.ABO,

    U.LED_ID,

    U.PROJECT_NO,

    T.WORDC,

    P.CHECKC,

    P.PIN_NO,

    FROM unit1 U

    INNER JOIN unit2 L

    ON U.ABO = L.ABO

    INNER JOIN LS..USER2.UNIT3 P

    ON L.CT_ID = P.CT_ID

    INNER JOIN unit4 T

    ON U.PCT = T.ACT

    AND U.FJT_TYP = T.FJT_TYP

    WHERE U.ABO like 'LE%'

    --AND U.CREATE_DT = TO_DATE('18/01/2009' ,'DD/MM/YYYY')

    AND U.CREATE_DT ='2009-01-18'

    ORDER BY U.ABO, U.LED_ID')

    Getting lot of syntax errors.. can you help me please. Also, since the query works if I remove either the order by clause or one of the where condition, could it be something to do with the ORAOLEDB we use in ODBC? like a setting to be changed?

    Thanks.

    Not sure what your errors are, but when using OPENQUERY you need to escape your quotes by double (single) quoting. E.g. WHERE U.ABO like ''LE%''