I need to generate an XML file from a SQL Server database daily and save it on the local machine. What is the way to do it other than using FOR XML clause?
Apart from being unable to output the result to a file, generating the file using this method only works correctly for smaller datasources. I've tried running the script for a datasource that contains 150k+ rows and the generated file just gets cut at some point and SSMS warns me about the file being too big.
I've tried setting the Maximum Characters Retrieved value to unlimited, but it doesn't really make any difference.
What is the best way to solve this problem?