Reputation: 15363
Given that:
SELECT * FROM OPENJSON(JSON_QUERY('[{"JobId":"2838","Options":1}, {"JobId":"2839","Options":1}]'))
Gives us:
key value type
0 {"JobId":"2838","Options":1} 5
1 {"JobId":"2839","Options":1} 5
How can I change my query to return the job ids?
value
2838
2839
Upvotes: 4
Views: 710
Reputation: 13641
This should do it
SELECT JobId
FROM OPENJSON('[{"JobId":"2838","Options":1}, {"JobId":"2839","Options":1}]')
WITH (JobId INT N'$.JobId');
Upvotes: 3