Friday, September 7, 2012

Save SQLServer Data into XML format


Saving Data FROM SQL Server to XML Format
Here am showing the way to Save SQL Table data from SQL server to XML format into Local file.
For that we need two Controls from Control flow task
  Here is the screen shot.





Execute SQL Task
Script Task.
First Create Connection for SQL Server. Right Click on connection Managers as Shown below.







Use appropriate Server name. In my case I used my local Database.
Select appropriate database.









Click on Test connection for testing Connection




Double Click on Execute SQL task.
Go to General tab as shown below.
Select Result set as XML from Dropdown.





Enter Query which will give the XML format







Select Result set tab. Set Result Name to Zero. Select variable name for saving data to variable.






Parse Query.





Select Script Task. Select Read only Variables








Edit Script. Add this code







Finally execute the package




After Successful Execution





No comments: