Jasinski Technical Wiki

Navigation

Home Page
Index
All Pages

Quick Search
»
Advanced Search »

Contributor Links

Create a new Page
Administration
File Management
Login/Logout
Your Profile

Other Wiki Sections

Software

PoweredBy

Page History: JSON Data in T-SQL - SQL Server

Compare Page Revisions



« Older Revision - Back to Page History - Newer Revision »


Page Revision: Thu, Oct 31, 2019, 11:45 AM


Overview

This article gives sample SQL for querying and parsing JSON data in SQL Server

Sample Data

The Before field looks like this

[{
    "Id": 392571,
    "CreatedOn": "2019-06-19T03: 00: 28"
}]

Sample Code

select top 10
     Id
    ,a.[Before]
    ,IdBefore       = json_value(a.[Before], '$[0]."Id"')
from 
    dbo.AuditLog a

ScrewTurn Wiki version 3.0.1.400. Some of the icons created by FamFamFam. Except where noted, all contents Copyright © 1999-2024, Patrick Jasinski.