-
Notifications
You must be signed in to change notification settings - Fork 34
Open
Labels
Description
Version - 170.128.0
Parser - TSql170Parser
JSON_OBJECT when inside RETURN statement does not get parsed with above mentioned parser version and details.
Steps to reproduce -
Try parsing the below SQL script with the parser:
ALTER FUNCTION FnName
()
RETURNS NVARCHAR(MAX)
AS
BEGIN
RETURN
JSON_OBJECT('Authorization' : 'Bearer ' + (SELECT Value1
FROM dbo.table1
WHERE field1 = 'Token'));
END;
GO
Example -
static void Main(string[] args)
{
var script = "<Example Script>";
var parser = new TSql170Parser(true, 0);
var fragment = parser.Parse(new StringReader(script), out var parseErrors);
if (parseErrors.Count > 0)
{
Console.WriteLine(parseErrors[0].Message);
}
}
Error message :-
Incorrect syntax near 'JSON_OBJECT'.
This issue is created as a part of follow-up for #137 since it was closed without a fix.