Incorrect syntax near 'JSON' - SQL Server 2016

Amjad picture Amjad · Jan 30, 2016 · Viewed 14k times · Source

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

Answer

Amjad picture Amjad · Jan 31, 2016
  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