Sonar Scanner T-SQL unable to parse file


(Giuseppe Petruzziello) #1

i’m using SonarQube Developer edition 7.3 with SonarScanner 3.2. During parsing my T-SQL code i’ve some errors like

WARN: Unable to parse file 'xxxxx.sql' : Parse error at line 7 column 4:

1:
2:
3:
4:
5:
6: CREATE TRIGGER [xxxx]
7: ON DATABASE
       ^

WARN: Unable to parse file 'xxxx.sql' : Parse error at line 34 column 16:

34:   WITH NOWAIT, SETERROR;

(Alban Auzeill) #2

Hi Giuseppe,

I can reproduce the parse error caused by ON DATABASE, so I created the ticket SONARTSQL-154 to support it in a following version.

And for what follow ON DATABASE, I don’t understand why there’s no AS ..., in my understanding T-SQL does not have a CREATE TRIGGER without AS ... in their documentation:
https://docs.microsoft.com/en-us/sql/t-sql/statements/create-trigger-transact-sql?view=sql-server-2017

Could you confirm that this statement (without AS and using NOWAIT and SETERROR) can be executed without error on your SQL Server?

Thanks for your feedback,

Alban


(Giuseppe Petruzziello) #3

Hi Alban,
of course in my code i have AS and the code is correclty executed by SQL Server.
But i 've other parsing problems like
126: if update(blt_wewr)
^
Thanks a lot
Giuseppe