SQLizer makes it painless to convert CSV files to SQL databases (in only 30 seconds too!) But for the sake of fairness we thought we’d outline three other ways you can convert CSV to SQL. You know… just in case you enjoy spending time doing fiddly, manual tasks.

First up, SQLizer.

Step 1: Choose the CSV file you want to convert to SQL

Choose your CSV file

Step 2: Select CSV as your file type

Select your CSV as your file type

Step 3: Select whether the first row contains data or column names

Does your first row contain data or column names?

Step 4: Type in a name for your database table

Type in a name for your database

Step 5: Convert your file!

Convert your file!

Here’s a video showing the exact steps to convert CSV to SQL in seconds…

SQLizer is hands down one of the easiest methods of converting CSV files to SQL databases. But as promised, here’s a breakdown of the manual ways of doing things.

How to manually convert CSV to SQL

The three ways we’re going to look at:

  • Importing a CSV file using MS SQL Server
  • Using find and replace in Excel
  • Using the MySQL console

CSV to SQL with Microsoft SQL Server

This method is less of a conversion and more of an import. It requires that you have Microsoft SQL Server installed. The basic steps are as follows:

  • Connect to your server and create a new database
  • Import the CSV file using the SQL Server wizard
  • Manually input text qualifiers and column width for every column (SQLizer automatically detects these)

If this appeals to you and you have access to Microsoft SQL Server, check out this video:

CSV to SQL using find and replace in Excel

This is a pretty tedious method, it has to be said. The basic principles are:

  • Open your CSV file in Excel and select the ‘find and replace’ option
  • Set it up to find , and replace with ,. Next find ^ and replace with insert insert myTable values\('
  • Finally find $ and replace with '\);

You might want to brew a coffee or something ‘cos this’ll take some time. Naturally, SQLizer does all of this for you.

Converting CSV to SQL using the MySQL Console

You’ll need some command line skills for this. The premise is quite simple but often goes wrong and needs tweaking a few times to get right, which takes a while.

Type the following into the MySQL Console:

load data infile 'c:/filename.csv' into table tablename fields terminated by ',';

You can see more on StackOverflow.

CSV to SQL: Many options but one solution

As well as the options outlined above there are even more ways to convert CSV files to SQL databases. All have the same outcome but the processes and time commitments are different.

If automation is your thing, SQLizer is by far the best way to convert CSV to SQL.

Ready to automate your CSV conversions and live a better life? Convert CSV files now.

SQLizer is free for less than 5,000 rows of data for personal use - if you have a >5000 row CSV file you need to convert, use code CONVERTME10 for 10% off your Pro Monthly plan for the first 12 months, or a one-off 10% discount on your Pro Annual plan.