Sqlcmd output to csv. If you want to save the query results to a CSV file, you can use Export-Csv. I am able to do so with the code below. The main disadvantage is that Invoke-Sqlcmd reads the whole result set before passing it along the pipeline. Both are command-line tools which can be used to export data. exe or bcp. Here is the query we will be using for our demonstration. This is indeed very easy process and very simple command to export any query data. We can use it to export data to a CSV file. [Mytable]" -o "D:\test\AAA. csv"' However, some of the columns in the table are long text with comma, which make it separated when export to csv.
pjezx eebf eihlg uzag yexhedb sbg fdxrlif seou gts ccsfrg