是否有SQL验证器可以针对多个数据库服务器检查语法?

时间:2022-12-22 00:55:33

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

是否有SQL验证器可以针对多个数据库服务器检查语法?

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

例如,我可能想检查一个特定的查询是否对Oracle、MySQL和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.

我更关心的是SQL语法,而不是被查询的实际模式,因此能够捕获主要语法错误的工具就足够了,比如检测SQL Server和Oracle中不支持的limit子句。


EDIT:

编辑:

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

一些回答建议检查特定DBMS或ANSI标准的语法。

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.

我正在寻找的目标是在两个或多个数据库(比如SQL Server和Oracle)之间建立某种特性联合的可能性。我希望能够使用我在特定应用程序中针对的所有DBMS支持的任何SQL特性。

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.

我不确定这是否值得。我认为这取决于几个数据库共享的非ansi特性的数量。如果数量很少,那么最好以ANSI标准为目标。

4 个解决方案

#1


7  

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

我不知道有什么特别的,这些将检查声明是有效的ansi 92/99/2003。

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

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

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

这将使您达到99%的目的(特别是如果只进行CRUD操作)

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

(如前所述)如果您的目标是创建一个与数据库无关的系统,请考虑使用第三方工具e。旅客:entityspaces

#2


2  

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.".

从SQL Server的角度来看,您可以检查语法,而不是针对多个数据库服务器检查SQL语法。这是基于ISO标准的。

Example:

例子:

SET FIPS_FLAGGER 'INTERMEDIATE'

#3


2  

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

对于MySQL:请尝试使用dbForge Studio中的自动SQL语法检查功能。

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

对于Oracle: PL/SQL编辑器在dbForge Studio中为Oracle。

#4


0  

This is an online mysql syntax checker, but this is mysql only http://www.piliapp.com/mysql-syntax-check/

这是一个在线的mysql语法检查器,但这只是mysql http://www.piliapp.com/mysql-syntax-check/

#1


7  

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

我不知道有什么特别的,这些将检查声明是有效的ansi 92/99/2003。

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

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

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

这将使您达到99%的目的(特别是如果只进行CRUD操作)

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

(如前所述)如果您的目标是创建一个与数据库无关的系统,请考虑使用第三方工具e。旅客:entityspaces

#2


2  

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.".

从SQL Server的角度来看,您可以检查语法,而不是针对多个数据库服务器检查SQL语法。这是基于ISO标准的。

Example:

例子:

SET FIPS_FLAGGER 'INTERMEDIATE'

#3


2  

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

对于MySQL:请尝试使用dbForge Studio中的自动SQL语法检查功能。

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

对于Oracle: PL/SQL编辑器在dbForge Studio中为Oracle。

#4


0  

This is an online mysql syntax checker, but this is mysql only http://www.piliapp.com/mysql-syntax-check/

这是一个在线的mysql语法检查器,但这只是mysql http://www.piliapp.com/mysql-syntax-check/