SSIS Sbustring Function in Dervied Colomn

  • hi i have a Source table in SSIS Package which has a column.

    Product

    052433779 - MONIACK CASTLE BLK CHERRY WINE 75CL

    053568969 - MONIACK MEAD 75CL

    059401426 - VIA CAPPELLA PINOT GRIGIO 75CL

    now i want to Create two colomn on the basis of this column by usisng Derived Column in SSIS Package.

    So that new colomn will have

    Product_Code Product_Desc

    052433779 MONIACK CASTLE BLK CHERRY WINE 75CL

    053568969 MONIACK MEAD 75CL

    059401426 VIA CAPPELLA PINOT GRIGIO 75CL

    Please Provide the Function(String)/Method which i can use ,, in Dervied Column Wizard.

    Pleae help.

  • Well, based on the data you have provided, you could do a couple of things:

      1. Use Substring like this:

      Product_Code: substring(Product, 1, Findstring(Product, " - ", 1) - 1)

      Product_Desc: SUBSTRING(product,FINDSTRING(product," - ",1) + 3,LEN(product))

      2. If the length of the Product_Code is constant then you could do this:

      Product Code: SUBSTRING(product,1,9)

      Product Desc: RIGHT(product,LEN(product) - 12)

  • thanks a lot buddy...

    it worked smoothly

    🙂

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply