1 Reply Latest reply: Jul 24, 2014 5:07 AM by Pradip Sen RSS

    Index Error

    Florian ROBERT

      Hi all,

       

      What I'm trying to do is:

      If the 3 first character of H_SUPPLIERID1 = ‘FOU’ then H_SUPPLIERID1 else H_SUPPLIERID1 without the 3 first character

       

      Ex : If ‘FOU_105758’ then ‘FOU_105758’

             If ‘55_FOU_105758’ then ‘FOU_105758’

       

      my code:

       

      SQL SELECT

        (H_CODE_SOCIETE) + '_' + (H_SUPPLIERID1) as CSUSUPID,

        (H_CODE_SOCIETE) + '_' + (H_CODE_SECTEUR) as IDCAPLAN,

        case when index(mid([H_SUPPLIERID1],3,1) '_')=0 then [H_SUPPLIERID1] else mid([H_SUPPLIERID1], 3) end as [SupplierId]

      FROM SHARE.dbo.IDX;

       

      The error message says there maybe a "with" or parenthesis missing with the index function.

      I'd be greaful for any help.

       

      Many thanks,

       

      Florian