Replace web links (https or www) if exist in the column through SSIS

PANDEY Prashant 145 Reputation points
2023-05-15T10:08:38.11+00:00

Hello Experts,

Having requirement to change the web addresses (either http/https/www) wherever they are appearing in a column so that on click the link will get open in the new tab.

The data type of existing attribute is changed from "text format" to rich text box within CRM, the agenda is to convert all existing data if they have any web links, they must be clickable.

I came to know that if an anchor tab can be added before the actual web address that link then get converted to clickable, without disturbing other existing sentence/words.

an example mentioned below

https://www.google.com

<a href="https://www.google.com/"><u>https://www.google.com/</u></a>

the existing data have all possible scenarios

like

  1. can have a sentence before any web address, like British Woodworking Federation: https://www.bwf.org.uk/
  2. can have only a single web address like https://www.bwf.org.uk/
  3. can have multiple web address being used within sentences, like ACAD (Asbestos Control and Abatement Division): http://acad.tica-acad.co.uk/
    ARCA (Asbestos Removal Contractors Association: http://www.arca.org.uk/
    HSE (Health & Safety Executive): http://www.hse.gov.uk/
    NFDC (National Federation of Demolition Contractors): http://demolition-nfdc.com/
    UKATA (UK Asbestos Training Association): http://www.ukata.org.uk/
    IATP (Independent Asbestos Training Providers): https://www.iatp.org.uk/
    BOHS (British Occupational Hygiene Society): http://www.bohs.org/
    RSPH (Royal Society for Public Health): https://www.rsph.org.uk/

so my requirement is to add anchor tag before and after the web address irrespective the recurrence and rest of the sentence remain same.

Thanks

Prashant Pandey

SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,704 questions
SQL Server | Other
{count} votes

1 answer

Sort by: Most helpful
  1. ZoeHui-MSFT 41,491 Reputation points
    2023-05-17T06:31:41.4+00:00

    Hi @PANDEY Prashant,

    Please try with below steps.

    Frist add a Derived Column:

    first part: TOKEN(data,":",1)

    second part: RIGHT(data,FINDSTRING(REVERSE(data),":",2) - 1)

    User's image

    And then add another Derived Column after that.

    target:[first part] + ":" + "<a href=" + """ + [second part] + """ + "><u>" + [second part] + "</u></a>"

    User's image

    User's image

    Regards,

    Zoe Hui


    If the answer is helpful, please click "Accept Answer" and upvote it.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.