解析sql中的JSON字符串

解析sql中的JSON字符串,sql,sql-server,json,sql-server-2008,Sql,Sql Server,Json,Sql Server 2008,我的表中有一列JSON字符串,我使用的是SQLServer2008。 关于如何解析JSON字符串和提取特定值有什么想法吗 以下是我的JSON字符串: {"id":1234,"name":"Lasagne al frono","description":"Placerat nisi turpis, dictumst nasceture ete etiam mus nec cum platea tempori zillest. Nisi niglue, augue adipiscing ete di

我的表中有一列JSON字符串,我使用的是SQLServer2008。 关于如何解析JSON字符串和提取特定值有什么想法吗

以下是我的JSON字符串:

{"id":1234,"name":"Lasagne al frono","description":"Placerat nisi turpis, dictumst nasceture ete etiam mus nec cum platea tempori zillest. Nisi niglue, augue adipiscing ete dignissim sed mauris augue, eros!","image":"images/EmptyProduct.jpg","cartImage":"images/ArabianCoffee.jpg","basePrice":54.99,"priceAttribute":"itemPrice","attributes":[{"type":"Addons","label":"Side","attributeName":"Side","display":"Small","lookupId":8},{"type":"Addons","label":"Drink","attributeName":"drink","display":"Small","lookupId":5},{"label":"add note","type":"Text","attributeName":"notes","display":"Wide","lookupId":null}]}

我需要提取“name”的值,有什么帮助吗?

因为sql server没有内置的JSON支持,您需要手动解析它,这会变得很复杂


但是,您可以随时使用其他人的。

对于解析JSON,您可以用C#或VB.NET编写一个简单的语法分析器。

现在您可以使用MS SQL Server 2016

几乎是dup of,它使用一个参数作为源而不是列进行询问,但有很好的答案,现在提到SQL Server 2016中的本机JSON支持。