Have you ever had the requirement to output data from a data-flow as a CSV file or an XML file where the choice is dependant on the file extension of your destination file?
Well, David Bulog (also known by the pseudonymn "Mr Pro Tools") has and he has posted his code to do this here.
I think David went through a bit of trauma to get this working but its great to see that he persevered and it just shows what can be achieved with SSIS when the out-of-the-box components do not meet your very specific requirement (which is what this is). Great stuff David, well done!!
Now, if David (or anyone else) could make that into a custom component rather than a script component then that's a great piece of custom functionality that we can all drop into our packages whenever we need it.
I've taken David's code and produced this executable demo. There's a boolean variable scoped to the data-flow which when set to TRUE will output the data as an XML file, otherwise a CSV file. David's code puts some header and footer information into the file which you can leave in there if you like, I've taken some of it out in my demo. The real trick here is outputting as XML or CSV and I didn't want to deflect attention away from that.
-Jamie