Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 687
Tahir Akhtar Avatar asked Oct 13 '11 10:10

Tahir Akhtar


People also ask

What is SQL Validator?

Validate SQL Syntax * All fields above are mandatory. EverSQL Validator is a free online syntax checker for MySQL SQL statements. The validator will compile and validate SQL queries to report for syntax errors.

How do I check if a SQL query is correct?

Check - The check is a way for you to check if you have written a legal SQL query. Arrow - This is the execute command button. This will send the query to the server and the server will write back the result to you. Square - This is the stop execution command.


2 Answers

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

like image 176
Kevin Burton Avatar answered Nov 15 '22 17:11

Kevin Burton


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'
like image 20
Bogdan Sahlean Avatar answered Nov 15 '22 18:11

Bogdan Sahlean