JSON Database compatability

Hi!

I am currently trying to get/modify JSON data and I’m trying to use OPENJSON but the compatibility is set to 120, would changing this to 130 have any detrimental effect on the database?

Thank you!

You are correct: JSON functionality is only found in SQL Server 2016 (130) and later.

Thanks for the reply @Memo!

So I my database was originally built on a SQL Server 2014 Local DB but I upgraded to SQL Server 2017(so I can use message server) and I migrated the 2014 db to the new 2017 db, but the compatibility level seemed to stay the same.

Do you know if it would have any negative effects if I changed the compatibility to 130?

If you went up to 2017 why the need to go down to 2016? JSON features are 2016 and up?

Ah sorry, my explanation wasn’t very clear.

Currently
image
my DB is compatibility 120.
(I’m assuming it’s 120 because I started out with the 2014 localDB, then upgraded to 2017 SQL server part way through; I haven’t touched compatibility at all so unsure why it would be set to 120 otherwise)

But now I’m trying to use OPENJSON which needs a 130 or above compatibility, and just wanted to make sure that if I change it to 130, it won’t break anything.

Not sure on the answer to that.
If hesitant about manually changing maybe try making a samba backup, start a fresh dB and restore samba in fresh dB.

If you’re running SQL Server 2017 set compatibility to 140.

It’s quick, easy, and will have no negative effects.

The compatibility level is stored inside the db so a 2014 db will tell the server engine to use that compatibility option no matter what.

@JTRTech I should have thought of that! Thank you!!

Perfect thank you so much Memo!!

1 Like