Export SQL data to CSV or XML File via Powershell

Sometimes it may be useful or necessary to use powershell to read data from SQL Server to export it to other formats This can also be used with older versions of Dynamics NAV which do not have access to the integrated powershell. Using standard powershell commands it is possible for example to read an SQL view and export it to CSV or XML file.

Source : Roberto Stefanetti Blog
Read more…