SQL Server Bulk INSERT with Square Bracket Quoting
Generate SQL Server-compatible bulk INSERT statements with square bracket identifiers, BIT booleans, and NVARCHAR string types.
Detailed Explanation
SQL Server-Specific Bulk INSERT
SQL Server has unique syntax requirements that set it apart from MySQL, PostgreSQL, and SQLite. The bulk INSERT tool generates fully compatible output when you select the SQL Server dialect.
Square Bracket Identifiers
SQL Server uses square brackets for quoting identifiers:
INSERT INTO [users] ([id], [first_name], [email])
VALUES
(1, 'Alice', 'alice@example.com'),
(2, 'Bob', 'bob@example.com');
Type Mappings
SQL Server uses different type names:
| Standard SQL | SQL Server |
|---|---|
BOOLEAN |
BIT |
VARCHAR(n) |
NVARCHAR(n) |
TEXT |
NTEXT |
INTEGER |
INTEGER |
DECIMAL(p,s) |
DECIMAL(p,s) |
The N prefix (NVARCHAR, NTEXT) indicates Unicode support, which is the modern standard for SQL Server.
Row Limit
SQL Server has a hard limit of 1,000 rows per INSERT statement. The tool respects this by capping the batch size at 1000 when SQL Server is selected.
Transaction Syntax
SQL Server uses BEGIN TRANSACTION (not just BEGIN):
BEGIN TRANSACTION;
INSERT INTO [events] ([id], [type])
VALUES
(1, 'login'),
(2, 'click');
COMMIT;
CREATE TABLE Example
CREATE TABLE [products] (
[sku] NVARCHAR(255) NOT NULL,
[name] NVARCHAR(255) NOT NULL,
[price] DECIMAL(10,2) NOT NULL,
[active] BIT NOT NULL
);
MERGE for Upserts
SQL Server does not support ON CONFLICT. For upserts, the MERGE statement is used, but its syntax is complex for bulk operations. The tool adds a comment noting this when upsert is selected for SQL Server.
Use Case
Your enterprise application runs on SQL Server and you need to generate import scripts from JSON data exports. The tool handles square bracket quoting, NVARCHAR types, and the 1000-row limit automatically.