I was exploring new Transact SQL JSON capabilities by running various example snippets in my regular SQL Server 2014 Management Studio against clean install of SQL Server 2016 Express. I've started to understand how it works, but suddenly got bitten by
Must declare the scalar variable
For example, this loading snippet worked before:
SELECT @json = BulkColumn
FROM OPENROWSET (BULK 'C:\JSON\Books\book.json', SINGLE_CLOB) as j
but now it spews:
Msg 137, Level 15, State 1, Line 1
Must declare the scalar variable "@json".
There are much more snippets from MSDN which either ceased to work or don't work when pasted to query window.
Why this happened? Did I break something? Is it related to older Management Studio and newer database engine?
DECLARE @json VARCHAR(4000)
– Nick.McDermaid