Declare @JSON varchar(max)
SELECT @JSON=BulkColumn
FROM OPENROWSET (BULK 'C:\Users\szakhour\Desktop\LastScore.json', SINGLE_CLOB) import
SELECT *
FROM OPENJSON (@JSON)
WITH
(
LeaderboardName varchar(20),
LeaderboardNameFull varchar(20),
PlayerCount varchar(20),
PlayerName varchar(20),
Score nvarchar(20),
ScoreDetails varchar(10)
)
CROSS APPLY OPENJSON (ScoreDetails)
WITH(
ZombiesKilled varchar(15)'$.ZombiesKilled',
Accuracy varchar(50)'$.Accuracy',
DamageTaken varchar(20)'$.DamageTaken',
SecondsInLevel varchar(30)'$.SecondsInLevel',
Deaths varchar(50)'$.Deaths' --AS JSON
)
{
"LeaderboardName": "Missile base",
"LeaderboardNameFull": "Missile base four players",
"PlayerCount": 4,
"PlayerName": "PLAYER",
"Score": 35360,
"ScoreDetails": {
"ZombiesKilled": "335",
"Accuracy": "31.32",
"DamageTaken": "100",
"SecondsInLevel": "1273",
"Deaths": "1"
}
}
Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.
Connect with Certified Experts to gain insight and support on specific technology challenges including:
We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE