Created
February 12, 2017 19:07
-
-
Save bertwagner/009e2b581b0882da0695f79b3e1dda1d to your computer and use it in GitHub Desktop.
TSQL Tuesday 87 Parsing JSON Pre 2016
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
NAME, | |
StringValue, | |
ValueType | |
FROM | |
( | |
SELECT | |
[NAME], | |
StringValue, | |
ValueType, | |
LAG([NAME],1,0) OVER (ORDER BY element_id, sequenceNo, parent_ID) as PreviousKey | |
FROM | |
Sandbox.dbo.parseJSON(@WebsiteJson) -- This is Phil Factor's JSON parsing function: https://www.simple-talk.com/sql/t-sql-programming/consuming-json-strings-in-sql-server/ | |
)d | |
WHERE | |
PreviousKey <> 'id' | |
and [NAME] = 'name' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment