Data Cleaning With SSIS

San 161 Reputation points
2021-07-09T11:45:12.513+00:00

Hi Experts,

Please help me to resolve this issue. First Set is raw data I want to clean the record and store into the TGT table as give below

User has changed the requirement they want to Just ignore the html phrase inside <Just want to Know> bracket. rest everything they want

Sample

PQWS,<Get>was it,<Mas>

Expected

PQWS, was it

I want the result in ssis and t-sql. Sorry again. Please help

SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,579 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,639 questions
{count} votes

Accepted answer
  1. Yitzhak Khabinsky 25,861 Reputation points
    2021-07-09T16:49:09.27+00:00

    Hi @San ,

    Please try the following expressison:

    (FINDSTRING(column, "<" , 1) == 0) ? column : LEFT(column, FINDSTRING(column, "<" , 1) - 2)  
    

    Both functions FINDSTRING() and LEFT() work only with the DT_WSTR data type. So you need to cast the column if it has a different data type.

    (FINDSTRING((DT_WSTR,256)column, "<" , 1) == 0) ? column : LEFT((DT_WSTR,256)column, FINDSTRING((DT_WSTR,256)column, "<" , 1) - 2)  
    

    I assumed that the 256 length is enough. It could be easily adjusted to accomodate the real length.

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. ZoeHui-MSFT 36,586 Reputation points
    2021-07-12T02:14:18.397+00:00

    Hi @San ,

    I think YitzhakKhabinsky-0887 has given the correct answer to resolve your issue.

    Don't forget to mark it as answer so other user with similar problem could see this easier. :)

    Regards,

    Zoe


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

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
    Hot issues October


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.