We help IT Professionals succeed at work.

SSIS 2012 Script Task:  How to add text to a file before working with it (prefer VB)

Jim Horn
Jim Horn asked
on
366 Views
Last Modified: 2016-02-11
Hi all

Question:  How in SSIS 2012 can I take a file such as the below code, insert the string<?xml version="1.0"?> in the beginning, then close it?  

Connections are fine.  Would prefer a VB script solution, but C# is fine.

<FlightInfo>
    <FlightKey>
        <Alc>SCX</Alc>
        <Number>0117</Number>
        <STD>2014-06-30T11:00:00Z</STD>
        <OriginIcao>KMSP</OriginIcao>
    </FlightKey>
    <Compute Timestamp="2014-06-30 09:09:00">
        <Fuels Unit="LBS">
            <Pre>27151</Pre>
            <Release>10651</Release>
            <Tankerage>16500</Tankerage>
            <Burn>3830</Burn>
            <Arrival>22996</Arrival>
            <Costs>
                <Origin Currency="USD" Quantity="USG">3.11</Origin>
                <Destination Currency="USD" Quantity="USG">4.00</Destination>
                <Savings Currency="USD">2098.98</Savings>
            </Costs>
        </Fuels>
        <Dispatcher>JOHNNY ROCKET</Dispatcher>
    </Compute>
</FlightInfo>

Open in new window

Comment
Watch Question

Ron MalmsteadInformation Services Manager
CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Senior Developer
CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Jim HornSQL Server Data Dude
CERTIFIED EXPERT
Most Valuable Expert 2013
Author of the Year 2015
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Jim HornSQL Server Data Dude
CERTIFIED EXPERT
Most Valuable Expert 2013
Author of the Year 2015

Author

Commented:
Hmm.  Now it's working, and I don't know why, as the only changes where moving the root folder, and changing the XSD location to be parameter-driven instead of hard-coded.

Thanks for the help
Jim
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.