For JSON, an error is thrown in SQL Server Management Studio

I tried to execute the command FOR JSON

in SQL Server Management Studio as shown in the following Microsoft website.

msdn.microsoft.com/en-us/library/dn921882.aspx

This is the table I'm trying to access:

https://www.dropbox.com/s/oielf4pbmjjxynu/JSON1.jpg?dl=0

And this is the command FOR JSON

I am trying to use to export data to JSON format similar to the Microsoft website example.

https://www.dropbox.com/s/j419fpn9ez67a4k/JSON2.jpg?dl=0

However, I kept getting the error saying I had a syntax error and I really don't know where the error is coming from. As far as I know, I am following all syntax correctly.

Please help me.

thank

+3


source to share


1 answer


FOR JSON is only available on SQL Server 2016. In older versions you have to use some CLR libraries that format JSON like http://www.json4sql.com/ or http://www.sqlservercentral.com/articles/ SQLCLR / 74160 /



+2


source







All Articles