如何使用SQL Server 2016导入/导出JSON数据

本文介绍了如何在SQL Server 2016中存储和导出JSON数据。使用内置函数ISJSON、JSON_VALUE、JSON_QUERY和FOR JSON,可以解析、提取和格式化JSON文本。示例展示了如何将JSON导入表,以及如何将SQL查询结果导出为JSON格式,包括使用PATH和AUTO模式的差异。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

JSON is an abbreviation for JavaScript Object Notation. JSON is very popular and currently the most commonly used data exchange format. Most modern web and mobile services return information formatted as JSON text, all database web services, web browsers (Firefox, Internet Explorer) return results formatted as JSON text or accept data formatted as JSON. Since external systems format information as JSON text, JSON is also stored in SQL Server 2016 as text. You can use standard NVARCHAR columns to store JSON data in SQL Server 2016.

JSONJavaScript Object Notation的缩写。 JSON非常流行,并且是当前最常用的数据交换格式。 大多数现代的Web和移动服务都返回格式为JSON文本的信息,所有数据库Web服务,Web浏览器(Firefox,Internet Explorer)都返回格式为JSON文本的结果或接受格式为JSON的数据。 由于外部系统将信息格式设置为JSON文本,因此JSON也作为文本存储在SQL Server 2016中。 您可以使用标准NVARCHAR列在SQL Server 2016中存储JSON数据。

This article will explain how to import JSON data into SQL Server 2016 table and how to export data from SQL Server 2016 table as JSON using SQL Server 2016 built-in functions.

本文将介绍如何使用SQL Server 2016内置函数将JSON数据导入SQL Server 2016表以及如何将数据从SQL Server 2016表导出为JSON。

With SQL Server 2016, built-in functions can parse JSON text to read or modify JSON values, transform JSON array of objects into table format, any Transact -SQL query can be run over the converted JSON objects, results of Transact-SQL queries can be formatted into JSON format.

使用SQL Server 2016,内置函数可以解析JSON文本以读取或修改JSON值,将对象的JSON数组转换为表格式,任何Transact -SQL查询都可以在转换后的JSON对象上运行,Transact-SQL查询的结果可以格式化为JSON格式。

So, let’s start. Below is a simple example of JSON:

所以,让我们开始吧。 以下是JSON的简单示例:

{
  ”BusinessEntityID”:1,
  ”NationalIDNumber”:”295847284″,
  ”JobTitle”:”Chief Executive Officer”,
  ”BirthDate”:”1969-01-29″,
  ”Gender”:”M”
}

{
“ BusinessEntityID”:1,
“ NationalIDNumber”:“ 295847284”,
“ JobTitle”:“首席执行官”,
“出生日期”:“ 1969-01-29”,
“性别”:“ M”
}

More information about structure of the JSON can be found on this link.

可以在此链接上找到有关JSON结构的更多信息。

Let’s declare a SQL Server variable and put JSON code in it.

让我们声明一个SQL Server变量并将JSON代码放入其中。

 
DECLARE @json varchar(max)='
   { 
      "BusinessEntityID":1,
      "NationalIDNumber":"295847284",
      "JobTitle":"Chief Executive Officer",
      "BirthDate":"1969-01-29",
      "Gender":"M"
   }   
';
 

One of the built-in JASON functions that are implemented in SQL Server 2016 is ISJSON.

ISJSON是SQL Server 2016中实现的内置JASON函数之一。

The ISJSON function verifies if it is the code in @json variable formatted as JSON. If the code in the @json variable, formats correctly the output value in the Results grid, 1 will appear:

ISJSON函数验证@JSON变量中的代码是否为JSON格式。 如果@json变量中的代码在“结果”网格中正确格式化了输出值,则将出现1:

Otherwise, the output value in the Results grid will be 0. For example, if the open curly bracket is omitted from the example above, the result will be:

否则,“结果”网格中的输出值将为0。例如,如果在上面的示例中省略了大括号,则结果将是:

To convert the JSON text into a set of rows and columns, the OPENJSON function is used.

转换的JSON文本转换成一组行和列的OPENJSON使用功能。

Syntax of the OPENJSON function that transforms JSON text to row and columns looks like:

将JSON文本转换为行和列的OPENJSON函数的语法如下:

OPENJSON (<json text>)
WITH (<column/type>)

OPENJSON(<json文本>)
WITH(<列/类型>)

In the WITH clause, the schema of returned rows with name of columns and their types is defined. The OPENJSON function will parse JSON object, match properties in JSON object with column names in the WITH clause and convert their values to specified types.

在WITH子句中,定义了具有列名及其类型的返回行的架构。 OPENJSON函数将解析JSON对象,将JSON对象中的属性与WITH子句中的列名进行匹配,并将其值转换为指定的类型。

In the example below, it is shown how to convert JSON text to set of rows and columns:

在下面的示例中,显示了如何将JSON文本转换为行和列集:

 
DECLARE @json varchar(max)='
    {
      "BusinessEntityID":1,
      "NationalIDNumber":"295847284",
      "JobTitle":"Chief Executive Officer",
      "BirthDate":"1969-01-29",
      "Gender":"M"
   }   
';
 
SELECT * FROM OPENJSON(@json)
WITH (BusinessEntityID int,
	 NationalIDNumber int,
	 JobTitle varchar(100),
	 BirthDate varchar(200),
	 Gender varchar(2)
)
 

The result will look like:

结果将如下所示:

BusinessEntityID NationalIDNumber JobTitle BirthDate Gender
1 295847284 Chief Executive Officer 1969-01-29 M
BusinessEntityID 身份证号码 职称 生日 性别
1个 295847284 首席执行官 1969-01-29 中号

If the SELECT statement without a WITH clause is executed:

如果执行不带WITH子句的SELECT语句:

 
DECLARE @json varchar(max)='
    {
      "BusinessEntityID":1,
      "NationalIDNumber":"295847284",
      "JobTitle":"Chief Executive Officer",
      "BirthDate":"1969-01-29",
      "Gender":"M"
   }   
';
 
SELECT * FROM OPENJSON(@json)
 

The following result will appear:

将显示以下结果:

key value type
BusinessEntityID 1 2
NationalIDNumber 295847284 1
JobTitle Chief Executive Officer 1
BirthDate 1969-01-29 1
Gender M 1
类型
BusinessEntityID 1个 2
身份证号码 295847284 1个
职称 首席执行官 1个
生日 1969-01-29 1个
性别 中号 1个
  1. key column contains the name of the property 列包含属性的名称
  2. value column contains the value of the property 列包含属性的值
  3. type column contains the data type of the value 类型列包含值的数据类型

The type column has six values for the data types:

类型列具有六个数据类型的值:

value data type
0 null
1 string
2 int
3 true/false
4 array
5 object
数据类型
0 空值
1个
2 整型
3 真假
4 数组
5 目的

To extract a scalar value from the JSON text and use it in the Transact-SQL queries, use the JSON_VALUE function. Let’s access to a value of the BusinessEntityID property from the @jason variable and use it in the WHERE clause to return some values from the Person.Person table in the AdventureWorks 2014 database. Paste and execute the following code:

要从JSON文本中提取标量值并在Transact-SQL查询中使用它,请使用JSON_VALUE 功能。 让我们从@jason变量访问BusinessEntityID属性的值,并在WHERE子句中使用它,以从AdventureWorks 2014数据库的Person.Person表中返回一些值。 粘贴并执行以下代码:

 
USE AdventureWorks2014
DECLARE @json varchar(max)='
    {
      "BusinessEntityID":1,
      "NationalIDNumber":"295847284",
      "JobTitle":"Chief Executive Officer",
      "BirthDate":"1969-01-29",
      "Gender":"M"
   }   
';
 
SELECT FirstName, LastName FROM Person.Person
WHERE  BusinessEntityID = JSON_VALUE(@json, '$.BusinessEntityID')
 

The results will look like:

结果将如下所示:

FirstName LastName
Ken Sánchez
名字
桑切斯

A Dollar sign $ is used to reference (access) of the properties, objects in JSON text. If it is omitted from the query:

美元符号$用于引用(访问)JSON文本中的属性,对象。 如果查询中省略了它:

 
USE AdventureWorks2014
DECLARE @json varchar(max)='
    {
      "BusinessEntityID":1,
      "NationalIDNumber":"295847284",
      "JobTitle":"Chief Executive Officer",
      "BirthDate":"1969-01-29",
      "Gender":"M"
   }   
';
 
SELECT FirstName, LastName FROM Person.Person
WHERE  BusinessEntityID = JSON_VALUE(@json, 'BusinessEntityID')
 

The following error may occur:

可能会发生以下错误:

Msg 13607, Level 16, State 3, Line 14
JSON path is not properly formatted. Unexpected character ‘B’ is found at position 0.

Msg 13607,Level 16,State 3,Line 14
JSON路径格式不正确。 在位置0处发现意外字符'B'。

To extract an array or an object from a JSON text use the JSON_QUERY function. Let’s execute the query that contain JSON_QUERY function:

要从JSON文本提取数组或对象,请使用JSON_QUERY函数。 让我们执行包含JSON_QUERY函数的查询:

 
DECLARE @json varchar(max)='
    {
      "BusinessEntityID":1,
      "NationalIDNumber":"295847284",
      "JobTitle":"Chief Executive Officer",
      "BirthDate":"1969-01-29",
      "Gender":"M"
   }   
';
 
SELECT JSON_QUERY(@json, '$.BusinessEntityID')
 

The result will be:

结果将是:

(No column name)
NULL
(无列名)
空值

The NULL value is returned because the JSON_QUERY function works with arrays and objects not with scalar values. To see the error message instead of the NULL value, type the word strict before dollar sign:

返回NULL值是因为JSON_QUERY函数可用于数组和对象,而不能用于标量值。 要查看错误消息而不是NULL值,请在美元符号前键入单词strict

 
DECLARE @json varchar(max)='
    {
      "BusinessEntityID":1,
      "NationalIDNumber":"295847284",
      "JobTitle":"Chief Executive Officer",
      "BirthDate":"1969-01-29",
      "Gender":"M"	
   }   
';
 
SELECT JSON_QUERY(@json, 'strict $.BusinessEntityID')
 

When the code above is executed, the following error message will appear:

执行以上代码后,将出现以下错误消息:

Msg 13624, Level 16, State 1, Line 12
Object or array cannot be found in the specified JSON path.

讯息13624,第16级,州1,第12行
在指定的JSON路径中找不到对象或数组。

Let’s add the Contact object in the @json variable and use the JSON_QUERY function:

让我们在@json变量中添加Contact对象,并使用JSON_QUERY函数:

 
DECLARE @json varchar(max)='
    {
      "BusinessEntityID":1,
      "NationalIDNumber":"295847284",
      "JobTitle":"Chief Executive Officer",
      "BirthDate":"1969-01-29",
      "Gender":"M",
      "Contact":{"Home":"036/222-333","Mob":"064/3376222"}
   }   
';
 
SELECT JSON_QUERY(@json, '$.Contact')
 

The following results will appear:

将显示以下结果:

(No column name)
{“Home”:”036/222-333″,”Mob”:”064/3376222″}
(无列名)
{“首页”:“ 036 / 222-333”,“暴徒”:“ 064/3376222”}

在SQL Server 2016中存储JSON数据 (Storing JSON Data in SQL Server 2016)

Inserting data into some SQL Server table using data from @json is the same as regular T-SQL. Execute the following code:

使用@json中的数据将数据插入某些SQL Server表中与常规T-SQL相同。 执行以下代码:

 
DECLARE @json varchar(max)='
    {
      "BusinessEntityID":1,
      "NationalIDNumber":"295847284",
      "JobTitle":"Chief Executive Officer",
      "BirthDate":"1969-01-29",
      "Gender":"M",
      "Contact":{"Home":"036/222-333","Mob":"064/3376222"}
   }   
';
 
SELECT * INTO Person
FROM OPENJSON(@json)
WITH (BusinessEntityID int,
         NationalIDNumber int,
         JobTitle varchar(100),
         BirthDate varchar(200),
         Gender varchar(2),
         Contact varchar(max)
)
 

The following results will appear:

将显示以下结果:

BusinessEntityID NationalIDNumber JobTitle BirthDate Gender Contact
1 295847284 Chief Executive Officer 1969-01-29 M NULL
BusinessEntityID 身份证号码 职称 生日 性别 联系
1个 295847284 首席执行官 1969-01-29 中号 空值

As you can see, the Contact column in the Person table have NULL value instead of {“Home”:”036/222-333″,”Mob”:”064/3376222″}.

如您所见,Person表中的Contact列的值为NULL,而不是{“ Home”:“ 036 / 222-333”,“ Mob”:“ 064/3376222”} 。

To insert values from the Contact object in the @json variable into the Contact column under the Person table, the AS JSON clause must be used. Let’s put this clause into a code and execute:

要将@json变量中Contact对象的值插入到Person表下的Contact列中,必须使用AS JSON子句。 让我们将此子句放入代码中并执行:

 
DECLARE @json varchar(max)='
    {
      "BusinessEntityID":1,
      "NationalIDNumber":"295847284",
      "JobTitle":"Chief Executive Officer",
      "BirthDate":"1969-01-29",
      "Gender":"M",
      "Contact":{"Home":"036/222-333","Mob":"064/3376222"}
   }   
';
 
SELECT * INTO Person
 FROM OPENJSON(@json)
WITH (BusinessEntityID int,
         NationalIDNumber int,
         JobTitle varchar(100),
         BirthDate varchar(200),
         Gender varchar(2),
         Contact varchar(max) AS JSON
)
 

But this time an error message will appear:

但是这一次会出现错误消息:

Msg 13618, Level 16, State 1, Line 30
AS JSON option can be specified only for column of nvarchar(max) type in WITH clause.

Msg 13618,第16级,状态1,第30行
只能为WITH子句中的nvarchar(max)类型的列指定AS JSON选项。

As the message says AS JASON option supports only nvarchar(max) data type. Let’s change data type for Contact column and execute the query again. After changing the data type of the Contact column from varchar(max) to nvarchar(max) and executing it, the following results will appear:

如消息所示,AS JASON选项仅支持nvarchar(max)数据类型。 让我们更改Contact列的数据类型,然后再次执行查询。 将Contact列的数据类型从varchar(max)更改为nvarchar(max)并执行后,将显示以下结果:

BusinessEntityID NationalIDNumber JobTitle BirthDate Gender Contact
1 295847284 Chief Executive Officer 1969-01-29 M {“Home”:”036/222-333″,”Mob”:”064/3376222″}
BusinessEntityID 身份证号码 职称 生日 性别 联系
1个 295847284 首席执行官 1969-01-29 中号 {“首页”:“ 036 / 222-333”,“暴徒”:“ 064/3376222”}

将SQL Server 2016数据导出为JSON (Exporting SQL Server 2016 data as JSON)

To format/export query results as JSON, use the FOR JSON clause with the PATH or AUTO mode. When export query results to JSON, one of the mode must be used with the FOR JSON clause, otherwise the following error will occur:

要将查询结果格式化/导出为JSON,请在PATHAUTO模式下使用FOR JSON子句。 将查询结果导出到JSON时,必须将其中一种模式与FOR JSON子句一起使用,否则会发生以下错误:

Msg 102, Level 15, State 1, Line 7
Incorrect syntax near ‘JSON’.

Msg 102,第15级,状态1,第7行
'JSON'附近的语法不正确。

The main difference between the PATH and AUTO mode is that, with the PATH mode, a user has a full control over the way of how to format the JSON output while with the AUTO mode the FOR JSON clause will automatically format the JSON output based on the structure of the SELECT statement.

PATH和AUTO模式之间的主要区别在于,使用PATH模式时,用户可以完全控制如何格式化JSON输出的方式,而使用AUTO模式时,FOR JSON子句将根据以下方式自动格式化JSON输出: SELECT语句的结构。

PATH mode

路径模式

Let’s use a simple example to demonstrate what the PATH mode with FOR JSON clause can do. In this example the Pesron.Person table is used from the AdventureWorks 2014 database. In a query editor, the following code should be pasted and executed:

让我们使用一个简单的示例来演示带有FOR JSON子句的PATH模式可以做什么。 在此示例中,使用了AdventureWorks 2014数据库中的Pesron.Person表。 在查询编辑器中,应粘贴并执行以下代码:

 
SELECT TOP 3   
       BusinessEntityID,  
       FirstName, 
       LastName,  
       Title,  
       MiddleName  
   FROM Person.Person  
   FOR JSON PATH
 

The JSON output will be:

JSON输出为:

[
  {
     “BusinessEntityID”:1,
     “FirstName”:”Ken”,
     “LastName”:”Sánchez”,
     “MiddleName”:”J”
  },
   {
     “BusinessEntityID”:2,
     “FirstName”:”Terri”,
     “LastName”:”Duffy”,
     “MiddleName”:”Lee”
   },
   {
     “BusinessEntityID”:3,
     “FirstName”:”Roberto”,
     “LastName”:”Tamburello”
  }
]

[
{
“ BusinessEntityID”:1,
“ FirstName”:“ Ken”,
“ LastName”:“Sánchez”,
“ MiddleName”:“ J”
},
{
“ BusinessEntityID”:2,
“ FirstName”:“ Terri”,
“ LastName”:“ Duffy”,
“ MiddleName”:“ Lee”
},
{
“ BusinessEntityID”:3,
“ FirstName”:“ Roberto”,
“姓氏”:“ Tamburello”
}
]

If you notice, the “Title” and in some sections the “MiddleName”properties don’t appear in the JSON output. This is because the “MiddleName” and “Title” contain null values. By default, null values are not included in the JSON output. In order to included null values from the query results into the JSON output use the INCLUDE_NULL_VALUES option.

如果您注意到,“标题”和“ MiddleName”属性在某些部分中不会出现在JSON输出中。 这是因为“ MiddleName”和“ Title”包含空值。 默认情况下,JSON输出中不包含空值。 为了将查询结果中的空值包含到JSON输出中,请使用INCLUDE_NULL_VALUES 选项

Let’s include INCLUDE_NULL_VALUES option in an example and execute the query:

让我们包括INCLUDE_NULL_VALUES 一个示例中的选项并执行查询:

 
 SELECT TOP 3   
       BusinessEntityID,  
       FirstName, 
       LastName,  
       Title,  
       MiddleName  
   FROM Person.Person  
   FOR JSON PATH, INCLUDE_NULL_VALUES  
 

The result will be:

结果将是:

[
   {
     “BusinessEntityID”:1,
     “FirstName”:”Ken”,
     “LastName”:”Sánchez”,
     “Title”:null,
     “MiddleName”:”J”
   },
   {
     “BusinessEntityID”:2,
     “FirstName”:”Terri”,
     “LastName”:”Duffy”,
     “Title”:null,
     “MiddleName”:”Lee”
   },
   {
     “BusinessEntityID”:3,
     “FirstName”:”Roberto”,
     “LastName”:”Tamburello”,
     “Title”:null,
     “MiddleName”:null
  }
]

[
{
“ BusinessEntityID”:1,
“ FirstName”:“ Ken”,
“ LastName”:“Sánchez”,
“标题”:为空,
“ MiddleName”:“ J”
},
{
“ BusinessEntityID”:2,
“ FirstName”:“ Terri”,
“ LastName”:“ Duffy”,
“标题”:为空,
“ MiddleName”:“ Lee”
},
{
“ BusinessEntityID”:3,
“ FirstName”:“ Roberto”,
“ LastName”:“ Tamburello”,
“标题”:为空,
“ MiddleName”:空
}
]

With the PATH mode, the dot syntax can be used, for example ‘Item.Title’ to format nested JSON output. For example, let’s add aliases for the Title and MiddleName columns:

在PATH模式下,可以使用点语法,例如'Item.Title'来格式化嵌套的 JSON输出。 例如,让我们为Title和MiddleName列添加别名:

 
SELECT TOP 3   
       BusinessEntityID,  
       FirstName, 
       LastName,  
       Title AS 'Item.Title',  
       MiddleName AS 'Item.MiddleName'  
   FROM Person.Person  
   FOR JSON PATH, INCLUDE_NULL_VALUES  
 

The JSON output will be:

JSON输出为:

[
   {
     “BusinessEntityID”:1,
     “FirstName”:”Ken”,
     “LastName”:”Sánchez”,
     “Item”:{
       “Title”:null,
       “MiddleName “:”J”
     }
   },
   {
     “BusinessEntityID”:2,
     “FirstName”:”Terri”,
     “LastName”:”Duffy”,
     “Item”:{
       “Title”:null,
       “MiddleName “:”Lee”
     }
   },
   {
     “BusinessEntityID”:3,
     “FirstName”:”Roberto”,
     “LastName”:”Tamburello”,
     “Item”:{
       “Title”:null,
       “MiddleName”:null
     }
   }
]

[
{
“ BusinessEntityID”:1,
“ FirstName”:“ Ken”,
“ LastName”:“Sánchez”,
“项目”:{
“标题”:为空,
“ MiddleName”:“ J”
}
},
{
“ BusinessEntityID”:2,
“ FirstName”:“ Terri”,
“ LastName”:“ Duffy”,
“项目”:{
“标题”:为空,
“ MiddleName”:“ Lee”
}
},
{
“ BusinessEntityID”:3,
“ FirstName”:“ Roberto”,
“ LastName”:“ Tamburello”,
“项目”:{
“标题”:为空,
“ MiddleName”:空
}
}
]

As you can see, the JSON output now contains the “Item” object and the “Title” and “MiddleName” properties inside it.

如您所见,JSON输出现在包含“ Item”对象以及其中的“ Title”和“ MiddleName”属性。

AUTO mode

自动模式

AUTO mode will automatically generate the JSON output based on the order of columns in the SELECT statement.

AUTO模式将根据SELECT语句中的列顺序自动生成JSON输出。

For example, if we use the previously example and instead of the PATH put the AUTO mode after FOR JSON clause

例如,如果我们使用前面的示例,而不是PATH,则将AUTO模式放在FOR JSON子句之后

 
SELECT TOP 3   
       BusinessEntityID,  
       FirstName, 
       LastName,  
       Title AS 'Item.Title',  
       MiddleName AS 'Item.MiddleName'  
   FROM Person.Person  
   FOR JSON AUTO, INCLUDE_NULL_VALUES    
 

The result will be:

结果将是:

[
   {
     “BusinessEntityID”:1,
     “FirstName”:”Ken”,
     “LastName”:”Sánchez”,
     “Item.Title”:null,
     “Item.MiddleName”:”J”
   },
   {
     “BusinessEntityID”:2,
     “FirstName”:”Terri”,
     “LastName”:”Duffy”,
     “Item.Title”:null,
     “Item.MiddleName”:”Lee”
   },
   {
     “BusinessEntityID”:3,
     “FirstName”:”Roberto”,
     “LastName”:”Tamburello”,
     “Item.Title”:null,
     “Item.MiddleName”:null
   }
]

[
{
“ BusinessEntityID”:1,
“ FirstName”:“ Ken”,
“ LastName”:“Sánchez”,
“ Item.Title”:空,
“ Item.MiddleName”:“ J”
},
{
“ BusinessEntityID”:2,
“ FirstName”:“ Terri”,
“ LastName”:“ Duffy”,
“ Item.Title”:空,
“ Item.MiddleName”:“ Lee”
},
{
“ BusinessEntityID”:3,
“ FirstName”:“ Roberto”,
“ LastName”:“ Tamburello”,
“ Item.Title”:空,
“ Item.MiddleName”:空
}
]

AUTO mode in this case when is used will have the results from one table which will not create the nested JSON output and the dot separator will be treated as the key with dots. But when two tables are joined, the columns from the first table will be treated as the properties of the root object and the columns from the second table will be treated as the properties of a nested object. A table name or alias of the second table will be used as a name of the nested array:

在这种情况下,如果使用AUTO模式,将使用一张表的结果,该表将不会创建嵌套的 JSON输出,并且点分隔符将被视为带点的键。 但是,当两个表联接在一起时,第一个表中的列将被视为根对象的属性,而第二个表中的列将被视为嵌套对象的属性。 表名称或第二个表的别名将用作嵌套数组的名称:

When the following query is executed:

执行以下查询时:

 
SELECT st.TerritoryID, st.Name AS Territory,  s.Name  FROM Sales.SalesTerritory st
INNER JOIN Sales.Customer c ON st.TerritoryID = c.TerritoryID
INNER JOIN Sales.Store s ON c.StoreID = s.BusinessEntityID
WHERE st.TerritoryID=2 AND s.Name LIKE 'W%'
FOR JSON AUTO
 

The result will be:

结果将是:

[
   {
     “TerritoryID”:2,
     “Territory”:”Northeast”,
     “s”:[
        {
          “Name”:”Wholesale Bikes”
        },
        {
          “Name”:”Wheelsets Storehouse”
        },
        {
          “Name”:”Weekend Tours”
        },
        {
          “Name”:”Wholesale Bikes”
        },
        {
          “Name”:”Weekend Tours”
        },
        {
          “Name”:”Wheelsets Storehouse”
        }
     ]
  }
]

[
{
“ TerritoryID”:2,
“地区”:“东北”,
“ s”:[
{
“名称”:“批发自行车”
},
{
“名称”:“轮船仓库”
},
{
“名称”:“周末游”
},
{
“名称”:“批发自行车”
},
{
“名称”:“周末游”
},
{
“名称”:“轮船仓库”
}
]
}
]

也可以看看: ( See also: )

翻译自: https://www.sqlshack.com/importexport-json-data-using-sql-server-2016/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值