Replace phrases from package variable

  • Hi,

    Within the package I am populating a variable (XMLOutput). The string contains unwanted text which needs to be removed before a XML file is generated.

    XMLOutput Example

    <ROOT>

    <Body>

    <Route>

    <RecID>3</RecID>

    <SourcePostCode>22</SourcePostCode>

    <DestinationPostCode>2</DestinationPostCode>

    <Mileage>2.000000000000</Mileage>

    </Route>

    <Route>

    <RecID>3</RecID>

    <SourcePostCode>23</SourcePostCode>

    <DestinationPostCode>3</DestinationPostCode>

    <Mileage>3.000000000000</Mileage>

    </Route>

    <Route>

    <RecID>8</RecID>

    <SourcePostCode>25</SourcePostCode>

    <DestinationPostCode>5</DestinationPostCode>

    <Mileage>5.000000000000</Mileage>

    </Route>

    </Body>

    </ROOT>

    I need to remove the '<ROOT>' and '</ROOT>' items and have seen that I can apply the following code using another variable:

    REPLACE(REPLACE(@User::[XMLOutput], "<ROOT>", ""), "</ROOT>", "")

    But how do I do this using SSIS?

    Thanks in advance,

  • With the same method. Create another variable that will hold the final result.

    Set the property EvaluateAsExpression of that variable to true, and then create an expression similar to the one you described above.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

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

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