Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Incorrect syntax near 'JSON' - SQL Server 2016

So I recently installed SQL Server 2016 CTP3 mainly for the JSON output feature. I am trying to using it in my SQL Query exactly like how its shown in the link below on MSDN. The keyword JSON does not turn blue and gives error "Incorrect syntax near 'JSON'"

https://msdn.microsoft.com/en-us/library/dn921882%28v=sql.130%29.aspx?f=255&MSPPError=-2147217396

What could be wrong?

EDIT: I'm testing it with AdventureWorks DB for SQL Server 2016. The query is

SELECT * FROM Person.Contact FOR JSON AUTO
like image 458
Amjad Avatar asked Jan 30 '16 17:01

Amjad


1 Answers

  1. Check if compatibility level is set to SQL Server 2016 or 130
  2. Connect to a 2016 instance instead of the older one. (Migrate DB)

Thanks to Martin and VR46

like image 54
Amjad Avatar answered Sep 22 '22 21:09

Amjad