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

JSON Data in T-SQL - SQL Server

RSS
Modified on Wed, Apr 07, 2021, 10:56 AM by Administrator Categorized as (Favorites), SQL Server

Overview

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

See Also


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.