Published on InterSystems Developer Community (https://community.intersystems.com)

Home > SQLQuery: Cannot use JSON_OBJECT with literals

Question
Rubens Silva · Sep 4, 2017

SQLQuery: Cannot use JSON_OBJECT with literals

Hello, I just noticed that the following query is not allowing when using cached queries.

The compiler will accuse the code about missing a closing quote.
Just so you know, if I use this query dynamically it works, so I guess it's related to the code linting.

Query T() As %SQLQuery [ SqlProc ]
{
SELECT TOP 3 JSON_OBJECT('lit':'Employee from','t':%TABLENAME,'name':Name,'num':SSN) FROM Sample.Employee
}

The bold part is what is causing the error.

Version 2017.

#Compiler #Object Data Model #Caché

Source URL:https://community.intersystems.com/post/sqlquery-cannot-use-jsonobject-literals