SQL parser error with top 1, order by

i’am using SonarQube Version 8.4.1 (build 35646) and i geting strange parse error on my TSQL file. This file contains a function that works fine. Original file is about 1k lines but i reproduced this error on a small file. Error not throwing when i remove ORDER BY constraction and that’s why i think sonar ignores for some reason “TOP (1)” construction because without it query really wrong.
How can i fix this error or is it bug?reproduce sonar parse error.txt (767 Bytes)

1 Like

Indeed, we already identified such a problem in our T-SQL parser thanks to the feedback of another user. This problem was tracked as SONARTSQL-249 and we fixed it a few months ago.
Updating SonarQube to the latest version should resolve your problem.