How to Convert a SQL File to CSV


SQL files are stored procedures saved to text file format. You open these files on a SQL Server, and the file's code retrieves records for you. You can use this code to retrieve files and export the results to a CSV file, which is a text-based format file that contains records separated by the comma character. These files are beneficial when you want to export records from your database.

  • Click the Windows "Start" button and type "cmd" in the search text box. Press "Enter" to open the command line window.

  • Type the following command in the prompt:

    SQLCMD -S mySQL -E -d customers -i myfile.sql -o output.csv -s

    This command connects to a SQL Server named "mySQL" and executes the SQL file named "myfile.sql" and exports it to "output.csv." Change these values to your own file values.

  • Press "Enter" to execute the code. The command executes, and your exported CSV file contains the results.

Tips & Warnings

  • Click the Windows "Start" button and type the CSV file in the search text box. Press "Enter" to find the file on your hard drive. Double-click it to check the results of the SQL file.

Related Searches


Promoted By Zergnet


Related Searches

Check It Out

Geek Vs Geek: Robot battles, hoverboard drag race, and more

Is DIY in your DNA? Become part of our maker community.
Submit Your Work!