I would like to export table from SQL Server 2012 to XML file. I have found nice answer and here how to make XML result from SQL Server database query, but still I am missing how to save this result physically into file.
SQL query is:
SELECT [Created], [Text]
FROM [db304].[dbo].[SearchHistory]
FOR XML PATH('Record'), ROOT('SearchHistory')
I use Microsoft SQL Server Management Studio to execute this result. I see the XML in a result window, but I cannot save it.
There is "Save Result As.." in context menu, but with 98900 rows I run out of my 8GB memory with this option.
Is there a way how to save this query directly to the XML file on disk?