How to Import CSV into SQL Server

There are four common approaches to getting CSV data into SQL Server: BULK INSERT, the bcp command-line tool, the SSMS Import Wizard, and plain INSERT statements. Each has trade-offs in speed, flexibility, and ease of use. This guide covers all four with examples.

💡 Quick path: If you just need INSERT statements from a CSV file, use the CSV to SQL INSERT Generator — paste your CSV data and download a ready-to-run SQL script with correct T-SQL escaping and NVARCHAR types.

Method 1: BULK INSERT

BULK INSERT is the fastest native method for importing CSV files. It reads the file directly from the server's filesystem (or a network path accessible to the SQL Server service account).

BULK INSERT dbo.customers
FROM 'C:\data\customers.csv'
WITH (
    FORMAT = 'CSV',
    FIRSTROW = 2,           -- skip header
    FIELDTERMINATOR = ',',
    ROWTERMINATOR = '\n',
    CODEPAGE = '65001',     -- UTF-8
    TABLOCK
);

Limitations: BULK INSERT has limited support for quoted fields containing delimiters. If your CSV has commas inside quoted values, consider using a format file or pre-processing the data into INSERT statements with the CSV to SQL INSERT tool.

Method 2: bcp (Bulk Copy Program)

The bcp command-line utility offers similar performance to BULK INSERT and can be scripted in automated pipelines.

bcp dbo.customers in "C:\data\customers.csv" ^
    -S localhost -d MyDatabase -T ^
    -c -t "," -r "\n" -F 2

The -F 2 flag skips the header row, -t sets the field delimiter, and -T uses Windows authentication.

Method 3: SSMS Import Wizard

SQL Server Management Studio provides a graphical Import Flat File wizard: right-click the database → Tasks → Import Flat File. The wizard auto-detects column types, lets you preview data, and handles the import without writing any SQL. This is the easiest option for one-off imports.

Method 4: INSERT Statements

For smaller datasets or when you need full control over data transformation, generating INSERT statements is the most portable approach. The SQL runs in any client — SSMS, Azure Data Studio, sqlcmd, or application code.

INSERT INTO [dbo].[customers] ([id], [name], [email], [amount]) VALUES
  (1, N'Alice Johnson', N'[email protected]', 250.00),
  (2, N'Bob Smith', N'[email protected]', NULL),
  (3, N'Carol Williams', N'[email protected]', 175.50);

The CSV to SQL INSERT Generator automates this: it handles escaping, NULL detection, type inference, Unicode N'' prefixes, and batching up to SQL Server's 1,000-row INSERT limit.

Choosing the Right Method

MethodSpeedQuoted FieldsPortability
BULK INSERTFastestLimitedSQL Server only
bcpFastLimitedCLI scriptable
SSMS WizardMediumGoodGUI only
INSERT statementsSlowerFullAny SQL client

Frequently Asked Questions

What is the fastest way to import CSV into SQL Server?
BULK INSERT is the fastest native method. For very large files (millions of rows), bcp offers similar performance with more command-line flexibility.
How do I handle quoted fields in BULK INSERT?
BULK INSERT has limited support for quoted fields. For CSV files with quoted values containing commas, consider using OPENROWSET with a format file, or pre-process the CSV into INSERT statements.
Can I import CSV into SQL Server without SSMS?
Yes. You can use T-SQL BULK INSERT from any SQL client, the bcp command-line utility, PowerShell with Invoke-Sqlcmd, or generate INSERT statements from the CSV and run them in any query tool.
How are NULLs handled during CSV import?
By default, empty fields in CSV are imported as empty strings. To convert empty fields to NULL, use KEEPNULLS with BULK INSERT or pre-process the CSV to replace empty values with NULL in your INSERT statements.
What encoding should my CSV file use?
UTF-8 is recommended. For BULK INSERT, specify CODEPAGE = 65001. If your data contains Unicode characters, ensure the target columns use NVARCHAR rather than VARCHAR.