I would like to export SQL data to an XML file so it can be read in COBOL. I am working with SQL Express 2008 r2.
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
I am using export data from query (table ) to XML in SQL when I have needs for autonomous transactions.
Way I do that , Is that I made SQL-CLR stored procedure which using C# (code) and XML.Writer for writing data to disk
heere is parts of my code in C# (you need to compile this )
Here is how you register your procedure
and finally here is how you call your sproc to write file to disk