Parse Error during Sonar TSQL Analysis

I am using the below configuration,
SonarQube V8.0-DE
Sonar TSQL 1.4.0
Sonar scanner-- V3.3

While scanning TSQL files, facing “Parse error”. I have checked with but still I am getting issue even though using latest Version of SonarTSQL plugin.

1.Parse error in String Aggregate function[Within group section]
Sample Snippet:
SELECT Distinct column1, column2+ ’ ’ + STRING_AGG(col3, ', ') WITHIN GROUP (ORDER BY col4 ASC) AS colm,

2.Parse error in multiline comment section
Sample Snippet:
/*select col1, col2 from tbl
where col1=" "
select col1, col2 from tbl
where col1=" "
/*select col1, col2 from tbl
where col1=" "

Usually this kind of comments section can be parsed in MS SQL

3.Parse error in keyword “union”

Sample Snippet: Select Top 13 empname, empdesg from
(select Top 13 personname, person desgn from person where cond1
order by personname desc


select Top 13 personname, person desgn from person where cond2
order by personname desc) a

Please advice on this.

Thanks in advance.


Indeed, we don’t support STRING_AGG...WITHIN GROUP and we should fix that. I created SONARTSQL-248 to track that problem.

We support multiline comments as documented in the reference:

Nested comments are supported. If the /* character pattern occurs anywhere within an existing comment, it is treated as the start of a nested comment and, therefore, requires a closing */ comment mark. If the closing comment mark does not exist, an error is generated.

If I run your snippet, SQL Server 14 fails with:

Missing end comment mark '*/'

Again, it seems that your snippet is not accepted by SQL Server, I get:

Incorrect syntax near the keyword 'union'

Thanks for your feedback.


Thanks for your response.

For the Point 1 &2: Am agreed on your feedback

Reg.Point 3: I am having same kind of queries in my application. But, all are working in sql server.
I have shared screenshot of sample screenshot of same snippet. It can be parsed in sql server whereas it is failed in sonar scanner.

Could you please check it again and revert me?


You’re right, SQL Server seems to execute your query without any problem.
I must have made a mistake when testing it the first time, sorry for that.
It seems that SQL Server accepts ORDER BY...UNION for a subquery but raises an error for a top-level query.
I created SONARTSQL-249 to track the issue.

Thanks a lot for your feedback!