Four Ways to Import a CSV File into MySQL, PostgreSQL, SQL Server and SQLite
A guide walks through four methods for loading a CSV file into a database table, ordered from fastest to most portable. For MySQL, it recommends LOAD DATA LOCAL INFILE, which requires enabling local_infile on both server and client and converting boolean text values through a user variable. For PostgreSQL, it suggests the psql \copy command, noting that plain COPY reads from the server's disk and needs elevated privileges that managed databases often lack. For SQL Server, it describes BULK INSERT, which needs a server-side file path and a version of 2017 or later to handle quoted fields, with BIT columns requiring conversion. For SQLite, it shows the .import command with a flag to skip the header row, and for small or reviewable datasets it recommends plain INSERT statements.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.



Discussion (0)
Log in to join the discussion and vote.
Log in