Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Export data from SQL Server 2008 R2 to CSV file format using PowerShell

$
0
0

Hi, I am working on exporting data from SQL Server 2008 R2 database to CSV file format. I want automate this and schedule it as a daily job. I would want to do this in PowerShell and suppress the record count at the very end.

Could please let me know how to write the PowerShell script.

sqlcmd -S localhost -d Test -E -Q "SELECT Id, formatcode, version, submissiondate, agency, coordinator, comments FROM dbo.TestCode" -o "D:\Test\ABCD.csv"
Thanks in advance......................

Ione



Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>