Skip to main content
CSV to SQL Converter

T-SQL & Microsoft SQL Server

CSV to SQL Server Converter

Generate T-SQL compliant INSERT, MERGE, UPDATE, and CREATE TABLE scripts with square-bracket escaping and 1,000-row batch protection.

100% Client-Side — Your CSV never leaves your browser.
Mode

Input Data

0 rows · 0 cols

Tip: Drag & drop a .csv or .tsv file anywhere in this panel.

SQL Output

0 statements
-- Generated SQL will appear here.
-- Paste CSV/TSV data, drop a file, or click "Load Sample CSV".
Shortcut: Cmd/Ctrl+Shift+C to copy SQL0 data rows processed

Converting CSV to SQL Server T-SQL Without SSMS Wizard Friction

When you need to import csv to sql server quickly for seed migrations, staging tables, or hotfix patches, opening the SQL Server Import and Export Wizard or configuring BULK INSERT file permissions on a remote server often slows you down. This csv to sql server tool acts as an instant csv to t-sql converter inside your browser, generating copy-paste-ready scripts for SSMS, Azure Data Studio, and sqlcmd with zero server uploads.

Every csv to sql server insert batch emitted here respects Microsoft T-SQL syntax conventions out of the box, including square-bracket identifier quoting, BIT literal conversion (1 and 0 instead of TRUE/FALSE), Unicode-safe NVARCHAR DDL definitions, and single-quote escaping ('').

Square-Bracket Identifier Escaping & Safe DDL

Business spreadsheets frequently include column headers with spaces, punctuation, or reserved T-SQL keywords such as Order, User, Date, or Select. In SQL Server, unquoted reserved identifiers raise immediate syntax errors. This generator wraps every table and column name in square brackets—such as [order_id] or [first name]—and escapes any closing ] character inside an identifier as ]].

When CREATE TABLE IF NOT EXISTS is checked, SQL Server uses an idiomatic IF OBJECT_ID(N'table_name', N'U') IS NULL CREATE TABLE [table_name] (...) guard because T-SQL does not support the CREATE TABLE IF NOT EXISTS clause directly. Column types automatically map to INT, BIGINT, DECIMAL(18, 4), BIT, DATETIME2, and NVARCHAR(MAX).

T-SQL MERGE Upserts & The 1,000-Row Batch Limit

Unlike single-row inserts, SQL Server enforces a strict ceiling of 1,000 rows per multi-row INSERT INTO ... VALUES (...) statement; passing 1,001 tuples throws Msg 10738 (The number of row value expressions in the INSERT statement exceeds the maximum allowed number of 1000 row values). Setting your Batch Size to 50, 100, 500, or 1000 automatically splits large CSV imports into valid, error-free T-SQL batches.

When synchronizing existing records by primary key, switching Query Mode to UPSERT emits a clean T-SQL MERGE INTO [table] AS [target] USING (VALUES ...) AS [source] statement. Matched rows update every non-key column via WHEN MATCHED THEN UPDATE SET, while new rows insert cleanly via WHEN NOT MATCHED THEN INSERT, terminated with the semicolon required by T-SQL MERGE.

Frequently Asked Questions

Common Questions & Dialect Details

How does this tool escape SQL Server identifiers and column names?

Every table and column identifier is wrapped in T-SQL square brackets such as [users] and [first_name], and any literal closing bracket inside a name is escaped as ]] so reserved words and spaces parse safely.

Why does SQL Server cap multi-row INSERT batches at 1,000 rows?

Microsoft SQL Server enforces a maximum of 1,000 row value constructors inside a single INSERT INTO ... VALUES (...) statement. This converter automatically chunks larger files into valid batches of up to 1,000 rows.

How are booleans and text columns mapped for SQL Server CREATE TABLE?

Boolean columns map to BIT using 1 and 0 literals, 32-bit integers map to INT (or BIGINT for larger values), timestamps map to DATETIME2, and text columns map to NVARCHAR(MAX) or NVARCHAR(255).

How does T-SQL MERGE UPSERT mode work?

Selecting UPSERT generates a MERGE INTO [table] AS [target] statement using a VALUES (...) AS [source] table constructor, updating matched rows on your key column and inserting unmatched rows cleanly.

Is my CSV data uploaded anywhere before generating T-SQL?

No. All CSV parsing and T-SQL generation run 100% locally in your web browser so sensitive corporate or customer exports never leave your workstation.