在没有JSON_VALUE的情况下获取sql中的json值

时间:2018-02-23 02:48:57

标签: sql json sql-server string

我想在没有JSON_VALUE的json对象中获取值(在SQL Server中)

json值:

{{
  "Url": "****",
  "Token": "",
  "Data": {
    "role_id": 1001,
    "data": {
      "stringvalue": [
        {
          "minage": "21"
        },
        {
          "maxage": "55"
        },
        {
          "primary_identity_file": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAgAAAQABAAD/7QCcUGhvdG9zaG9wIDMuMAA4QklNBAQAAAAAAIAcAmcAFHpFZEQyY1ZzbGVyRzNrcF8yTjhHHAIoAGJGQk1EMDEwMDBhYzAwMzAwMDAwMjMxMDAwMDQxNzQwMDAwYjQ3YjAwMDBhMTgyMDAwMDliY2EwMDAwMjkyMDAxMDBmODJhMDEwMGFiMzQwMTAwMDgzZTAxMDBjZGM0MDEwMP/iAhxJQ0NfUFJPRklMRQABAQAAAgxsY21zAhAAAG1udHJSR0IgWFlaIA"
        }
      ]
    }
  }
}}

我想做的是采取" primary_identity_file"值

结果应该是:

data:image/jpeg;base64,/9j/4AAQSkZJRgABAgAAAQABAAD/7QCcUGhvdG9zaG9wIDMuMAA4QklNBAQAAAAAAIAcAmcAFHpFZEQyY1ZzbGVyRzNrcF8yTjhHHAIoAGJGQk1EMDEwMDBhYzAwMzAwMDAwMjMxMDAwMDQxNzQwMDAwYjQ3YjAwMDBhMTgyMDAwMDliY2EwMDAwMjkyMDAxMDBmODJhMDEwMGFiMzQwMTAwMDgzZTAxMDBjZGM0MDEwMP/iAhxJQ0NfUFJPRklMRQABAQAAAgxsY21zAhAAAG1udHJSR0IgWFlaIA

**注意primary_identity_file值超过10K字符

1 个答案:

答案 0 :(得分:2)

我尝试这样的事情:

 <ivy:resolve file="ivy-3rdpartypkgs.xml"/> 

您可以以更易读的方式重写为存储过程

示例小提琴http://sqlfiddle.com/#!18/a122b/7