Are there any SQL Validators that can check syntax against multiple database servers?

23,753

Solution 1

I'm not aware of any that are that specific, these will check that the statements are valid ansi 92/99/2003...

http://developer.mimer.com/validator/index.htm

That will get you 99% of the way there (especially if are only doing CRUD operations)

maybe if you know which reserved words are used by which database you could roll your own simple checker.. see : How to find if a column name is a reserved keyword across various databases

(as already mentioned) If your goal is to create a database agnostic system think about using a third party tool e.g: entityspaces

Solution 2

For the MySQL: try automatic SQL syntax check feature in dbForge Studio for MySQL.

For the Oracle: PL/SQL Editor in dbForge Studio for Oracle

Solution 3

From SQL Server point of view, instead of checking sql syntax against multiple database server you could check syntax "for compliance with the FIPS 127-2 standard. This is based on the ISO standard.".

Example:

SET FIPS_FLAGGER 'INTERMEDIATE'
Share:
23,753
Tahir Akhtar
Author by

Tahir Akhtar

linkedin

Updated on September 30, 2021

Comments

  • Tahir Akhtar
    Tahir Akhtar over 2 years

    Are there any SQL Validators that can check syntax against multiple database servers?

    For example, I might want to check whether a particular query will work against Oracle, MySQL and SQL Server.

    I am more concerned about the SQL syntax than the actual schema being queried, so a tool that can catch major syntax errors, like detecting that the limit clause is not supported in SQL Server and Oracle would be good enough.


    EDIT:

    Several answers have suggested checking syntax for a particular DBMS or for ANSI Standard.

    What I am looking for a possibility of targeting a sort of union of features between two or more databases (say SQL Server and Oracle). I would like to be able to use any SQL feature that is supported by all of the DBMS I am targeting in a particular application.

    I am not sure if it is worthwhile. I think it depends upon the number of non-ANSI features shared by several databases. If there are very few, then perhaps it will be better to target the ANSI standard.

  • Matija
    Matija over 9 years
    I lost bunch of time on one simple syntax error, I didn't close parenthesis (round brackets) in declaration of stored procedure. This link helped me out... http://developer.mimer.com/validator/parser200x/
  • Armen Markossyan
    Armen Markossyan over 8 years
    You have to build Mac versions of your apps :)