Parse error with T-SQL in sonar-scanner for SQL files

Hello,
I’m using Enterprise Edition Version 9.6 with built-in SonarTSQL plugin v1.6 (build 4844) is installed.
I faced with "WARN: Unable to parse file … : Parse error at line N column M: ", and I’m getting this error for many sql files. These files are skipped from scanning process(more then 1000 files).
Could you please advice how to avoid it.
Screen shots attached
Thanks.


Hello @evyaroshevich,

I couldn’t reproduce the issues shown in the screenshot on my machine. The statements highlighted (select from, Deallocate, Goto, and Commit) are supported by our parser. What I realized is that there are some differences between the SQL shown and the grammar defined for T-SQL:

Deallocate

Definition for T-SQL

DEALLOCATE { { [ GLOBAL ] cursor_name } | @cursor_variable_name }

Example:

DEALLOCATE @MyCursor;  

Your syntax

Deallocate Cursor MoveKonv

Commit

Grammar

COMMIT [ { TRAN | TRANSACTION } [ transaction_name | @tran_name_variable ] ] [ WITH ( DELAYED_DURABILITY = { OFF | ON } ) ]

Example

COMMIT TRANSACTION Inner2;

or grammar for commit work

COMMIT [ WORK ] [ ; ]
Example

COMMIT WORK;

Your syntax

Commit Work DelPart;

Summary

It looks like the files are not T-SQL files. Are these files used for Microsoft SQL-Server? The file extension PRO is unusual for T-SQL files. Maybe these files are used for another DBMS.

If you use these files in conjunction with Microsoft SQL-Server, you should share the first parsing error of the files (other errors might be consequential), so we can reproduce the error on our side.

Best, Martin

Hello @Martin_Strecker!
We use T-SQL (Sybase SAP AG), as far as I understand - they differ in syntax from T-SQL (Microsoft).
Can Sonarqube scan Sybase projects?
Best Regards

Hello @evyaroshevich,

We only support the Microsoft Server dialect of T-SQL, unfortunately. Both dialects seem similar, so you may benefit from the analysis regardless. We do not currently plan to support any of the SAP Adaptive Server Enterprise (Sybase) Grammar.

Best regards, Martin

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.