The following code works in my local instance of Sql Server but fails in remote instance with error Can you please help me out on this. Getting Error@
102: Incorrect syntax near '$.Location'
If (len(@JsonBODetails) > 0)
Begin
Insert Into #Temp_BOLines
SELECT * FROM
OPENJSON ( @JsonBODetails )
WITH (
Location varchar(2) '$.Location' ,
JCA varchar(4) '$.JCA'
)
End
Edit: SQL Server version. It is the same in both the cases.
Microsoft SQL Server 2017 (RTM-CU13-OD) (KB4483666) - 14.0.3049.1 (X64) Dec 15 2018 11:16:42 Copyright (C) 2017 Microsoft Corporation Web Edition (64-bit) on Windows Server 2016 Datacenter 10.0 (Build 14393: ) (Hypervisor)
Adding the complete procedure to repro this error
declare @JsonBODetails varchar(max)
SELECT * FROM
OPENJSON ( @JsonBODetails )
WITH (
Location varchar(2) '$.Location' ,
JCA varchar(4) '$.JCA'
)