From:       To:      

SQL Server to CSV

Latest version 1.3 released 05/06/2016

SQL Server to CSV converter is a free program to export MS SQL data into comma separated values (CSV) files. The program has high performance due to direct connection to source databases and writing into .csv files (it does not use ODBC or any other middleware). Command line support allows to script, automate and schedule the conversion process.


  • All versions of SQL Server are supported (including Azure SQL)
  • Option to convert individual tables
  • Option to convert partial data using SELECT-queries
  • Option to select separator: tab, comma or semicolon
  • Option to store conversion settings into profile
  • Command line support
  • Easy-to-use wizard-style interface
  • Full install/uninstall support
  • Unlimited 24/7 support service
  • Freeware!


  • Supported OS: Windows 7/8/10/11, Server 2008/2012/2016/2019/2022, Linux with WINE (contact us if you need version for Windows XP or Server 2003)
  • Necessary privileges to read the source database on MS SQL server
1. Welcome Screen 2. Connect to Microsoft SQL Server
3. Conversion Settings 4. Select Tables

Download SQL Server to CSV converter

Command Line

To perform batch conversion or call the conversion procedure from an automation script you can use console version of SQL Server to CSV converter. This is file M2CAGENT.EXE in the installation folder. You can either run this tool directly from command line or call it from any script as well. The program supports the following command-line options:

--dest=...   path to the folder with .csv files
--help   display help message and exit
--host=...   MS SQL server IP address or network name
--inc_fnames   include MS SQL field names into CSV files
--logfile=...   path to the logfile where execution traces will be written
--mode=...   how to process an existing CSV folder (0 - overwrite the entire folder, 1 - overwrite existing files only, 2 - skip existing files)
--n_delim=...   delimiter symbol to use in the resultinig CSV file (0 - tab, 1 - semicolon, 2 - comma)
--profile=...   path to the file to load conversion settings from
--pswd=...   MS SQL user password
--silent   use this option to disable program output
--src=...   MS SQL database name
--tab_file=...   file containing the list of tables to convert
(one table name per line)
--user=...   MS SQL user name

In the following example the program converts database "db1" on the remote SQL Server "mssqlhost" into .csv files in folder "c:\from mssql" using table names file "c:\tabfile1.txt":

M2CAGENT.EXE --src=db1 --dest="c:\from mssql" --host=mssqlhost --user=administrator 
--pswd=the_passsword --tab_file=c:\tabfile1.txt 

Table names file should be formatted as follows:



  1. You can omit 'host' parameter to connect local MS SQL server
  2. If you omit 'tab_file' parameter, all database tables will be converted
  3. Command line parameters that contain spaces should be enclosed in quotes (for example --dest="c:\my database")
  4. If you omit 'mode' parameter, default mode 'overwrite the entire folder' will be used

Download SQL Server to CSV converter

Using Queries

SQL Server to CSV converter allows to process result of SELECT queries as a regular table. This feature gives you the ability to extract partial data for converting into CSV format. The following examples are provided to illustrate how to use queries for particular purposes. Assume that we have table "Table1" as below:

	FName VARCHAR(50),
	LName VARCHAR(50), 
	Birthday DATE, 
	Notes TEXT

Example 1. Convert certain records.

    SELECT * FROM Table1 WHERE ID > 1000

Example 2. Choose and rename columns.

    SELECT FName as FirstName, LName as LastName FROM Table1

Example 3. Skip records containing NULL values.


Download SQL Server to CSV converter