I wanted to parse a string in JSON on a SQL Server 2008 R2 instance.
I read this awesome article by Phil over here and also looked at this SO question.
I downloaded the JSON.sql from simpletalk site and tried running on my local SQL Server instance.
But I got errors - (pasting it as such)
Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'AS'.Msg 102, Level 15, State 1, Procedure ToJSON, Line 6
Incorrect syntax near 'READONLY'.Msg 1087, Level 15, State 2, Procedure ToJSON, Line 67
Must declare the table variable "@Hierarchy".Msg 1087, Level 15, State 2, Procedure ToJSON, Line 90
Must declare the table variable "@Hierarchy".Msg 178, Level 15, State 1, Procedure ToJSON, Line 98
A RETURN statement with a return value cannot be used in this context.Msg 102, Level 15, State 1, Procedure ToXML, Line 6
Incorrect syntax near 'READONLY'.Msg 1087, Level 15, State 2, Procedure ToXML, Line 29
Must declare the table variable "@hierarchy".Msg 1087, Level 15, State 2, Procedure ToXML, Line 43
Must declare the table variable "@hierarchy".Msg 1087, Level 15, State 2, Procedure ToXML, Line 47
Must declare the table variable "@hierarchy".Msg 1087, Level 15, State 2, Procedure ToXML, Line 53
Must declare the table variable "@hierarchy".Msg 178, Level 15, State 1, Procedure ToXML, Line 65
A RETURN statement with a return value cannot be used in this context.
Is there anything I need to do before running JSON.sql?
Edit:When I checked SQL Server version using SSMS....Help --> About, it showed the following
After @marc_s suggestion checked the version using @@version command. Surprisingly this showed my instance to be thus
Any idea what could be happening?