none
replace function RRS feed

  • Question

  • <style type="text/css">.fctbNone{ color:#000000; } .fctbStyle1{ color:#ff1493; } .fctbStyle2{ color:#0000ff;font-weight:bold; } </style>Replace(Column,Substring([Column], 50, 18), [Id], false)

    Replace(source, search, replace, boolean)

    Is this accurate? I am not getting desired results. My source text is the column, search text is the substring part of the column, the id is what I want to replace substring text with, and the false


    Sonya

    Thursday, September 12, 2019 5:50 PM

All replies

  • Hi Sonya,

    1. Please share your data sample, what you need to do with it,  and a desired output.
    2. Are you using (1) SSIS Derived Column Task expression in a Data Flow or (2) T-SQL on the source? 



    Thursday, September 12, 2019 6:08 PM
  • I am using a derived column

    I am taking a URLpath colum as the source text and then using SUBSTRING to search for a particular in the path after position 50 where the length is 18. then replace that substring with a new id. Therefore, the new URLpath will something like

    https://www.xxxxxxxxxx.com/r/xxxxxxxx?xxxxxxxID=111111111111111111&ResponseID=xxxxxxxxxxxxxxxxx

    Replace(URLpath,Substring([URLpath], 50, 18), [Id], false)


    Sonya

    Thursday, September 12, 2019 6:42 PM
  • Hi Sonya,

    Please try the following expression for the Derived Column:

    REPLACE([URLpath], SUBSTRING([URLpath], 50, 18), [Id])

    You may need to CAST the [Id] column...


    Thursday, September 12, 2019 7:10 PM
  • Hi samcneal,

    REPLACE in SSIS Expression only contains three components.

    Please refer to REPLACE (SSIS Expression).

    Could you explain what does the "false" mean?

    Regards,

    Zoe


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Friday, September 13, 2019 1:39 AM