Reputation: 5
I am trying to explode the array value. But I am getting error `'Apply' can only be used with functions 'getarrayelements, getrecordproperties'.
select a.[id],row1.arrayvalue from input a
CROSS APPLY
[row] AS row1
Input data is
[
{
"id": "ada1",
"row": [1,2,3]
},
{
"id": "ada2",
"row": [5,4,7,9]
}
]
output expected:
id,row
ada1,1
ada1,2
ada1,3
ada2,5
ada2,4
ada2,7
ada2,9
select a.[id],row1.arrayvalue from input a
CROSS APPLY
[row] AS row1
Upvotes: 0
Views: 36
Reputation: 11284
Use the below code to achieve your requirement.
select rakeshinput.id,row.ArrayValue as row1 from rakeshinput CROSS APPLY GetArrayElements(rakeshinput.row) as row;
Output:
Reference:
Upvotes: 0