---
title: "Convert JSON to SQL Server"
description: "Convert JSON files to SQL for SQL Server in your browser: a CREATE TABLE with typed columns, then INSERT statements. Free, and your file is never uploaded."
canonical: https://intosql.com/json-to-sql-server
last_updated: 2026-10-15
---

# Convert JSON to SQL Server

Drop your JSON file to get a SQL Server script with CREATE TABLE and INSERT statements. Each column gets a type, and every fix is listed with its row and column.

## From JSON to SQL Server, column by column

The sample above, pedidos_2024.json, as IntoSQL writes it for SQL Server: what each column holds in the file, the type it gets and how its first value lands in the script.

| In the file | First value | Column | SQL Server type | In the script |
| --- | --- | --- | --- | --- |
| pedido | `000481` | `pedido` | `nvarchar(8)` | `N'000481'` |
| cliente | `Peña Muñoz` | `cliente` | `nvarchar(16)` | `N'Peña Muñoz'` |
| fecha | `2024-02-03T10:15:00Z` | `fecha` | `datetimeoffset` | `'2024-02-03T10:15:00+00:00'` |
| total | `1234.5` | `total` | `decimal(6,2)` | `1234.5` |
| pagado | `true` | `pagado` | `bit` | `1` |
| notas | `` | `notas` | `nvarchar(32)` | `NULL` |

## Load the script into SQL Server

The download is a plain .sql file. Run it with SQL Server's own tools.

### SQL Server

```shell
sqlcmd -S localhost -d mydb -f 65001 -i pedidos_2024.sql_server.sql
```

-f 65001 reads the file as UTF-8, so accents and ñ arrive as written. In SQL Server Management Studio or Azure Data Studio, open the file and choose Execute.

## What IntoSQL reads in JSON files

- The file can be an array of objects, an object that holds that array under a key such as data, or one object per line (NDJSON).
- Each key becomes a column. Objects and arrays inside a value are kept as JSON text.
- Numbers keep their exact digits, and ISO 8601 dates become dates or timestamps.

## What to know about SQL Server

- Text is nvarchar with N'...' values, so accents survive; text over 4000 characters becomes nvarchar(max).
- Yes and no values become bit, and dates with an offset become datetimeoffset.
- Long values are written in pieces, so sqlcmd and SQL Server Management Studio accept the script.

### How each kind of value is stored in SQL Server

| Value | SQL Server |
| --- | --- |
| Yes and no | `bit` |
| Whole numbers | `int` |
| Large whole numbers | `bigint` |
| Decimals | `decimal(p,s)` |
| Floating-point numbers | `float` |
| Dates | `date` |
| Times of day | `time` |
| Dates with a time | `datetime2` |
| Dates with a time and offset | `datetimeoffset` |
| Text | `nvarchar(n) · nvarchar(max)` |

## Questions about JSON to SQL Server

### How do I convert JSON to SQL Server?

Drop your file on the converter at the top of this page. It finds the header, reads every value and writes the SQL Server script, listing each fix it made. Download the script and run it with sqlcmd.

### What shape does the JSON file need?

An array of objects, an object that holds that array under a key such as data, or one object per line (NDJSON). Each key becomes a column.

### Which SQL Server types does it use?

Yes and no values become bit, whole numbers int, decimals decimal(p,s), dates date, dates with a time datetime2 and text nvarchar(n). Sizes come from the longest value in each column.

### Does it keep leading zeros in SQL Server?

Yes. A code such as 000481 stays text, so SQL Server stores it as nvarchar(8) and the script writes it as N'000481'.

### Can it load the data into SQL Server without a script?

No. Download the script and run it with sqlcmd. Loading without a script works for PostgreSQL, MySQL, MariaDB and SQLite, from the desktop app or the command line.

### How big can the JSON file be?

NDJSON, one object per line, is read as it streams in, so files of several gigabytes work in the browser. A JSON document is read whole, so its limit is the memory the browser gives this page. The desktop app and the command line take files of any size.

## JSON into other databases

- [Convert JSON to SQL](https://intosql.com/json-to-sql)
- [Convert JSON to PostgreSQL](https://intosql.com/json-to-postgresql)
- [Convert JSON to MySQL](https://intosql.com/json-to-mysql)
- [Convert JSON to MariaDB](https://intosql.com/json-to-mariadb)
- [Convert JSON to SQLite](https://intosql.com/json-to-sqlite)
- [Convert JSON to Oracle](https://intosql.com/json-to-oracle)

## Other files into SQL Server

- [Convert Excel to SQL Server](https://intosql.com/excel-to-sql-server)
- [Convert CSV to SQL Server](https://intosql.com/csv-to-sql-server)
