I am using the script task in SSIS Control flow task to save the output from the Execute SQL task to flat file destination. I tried the following script but did not succeed in getting the desired output
Script :-
string content = Dts.Variables["User::DataXML"].Value.ToString().Replace("<ROOT>", "<?xml version=\"1.0\" encoding=\"utf-8\" ?>").Replace("</ROOT>", "");
string filePath = Dts.Variables["User::FilePath"].Value.ToString();
StreamWriter writer = new StreamWriter(filePath);
writer.WriteLine(content);
writer.Close();
Output in XML file :- 'Strict' ;
Required output :-
<?xml version="1.0" encoding="utf-8"?>
<importemployee ............>
.....
.......
Figured out the script :-
Only changes in :-
string content = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>" + Dts.Variables["User::DataXML"].Value.ToString().Replace("<ROOT>", "").Replace("</ROOT>", "");