SQL Scheduled Exports

We needed a solution to export SQL data to csv. Turns out the SQL Server already has all of the tools necessary to do this.

To create the export job, you simply launch SQL Server Import and Export data tool. Walk through the wizard.

Source should be Microsoft OLEDB Provider for SQL Server
Destination should be Flat File Destination

The last page of the wizard has a checkbox to save the SSIS package. Select this option and Save to the file system. The next page will prompt where you would like to save the package.

Now you have an export job that you can schedule. The command line tool for running your job is dtexec and should be in your SQL Server programs directory. On our system it is in C:\Program Files\Microsoft SQL Server\130\DTS\Binn\

The command is easy to use, dtexec.exe /file filename.dtsx

Both the dtexec and filename should include the full path unless you  are already in one of those directories.

Another reference site with additional details.