如何在各种数据库中查找列名是否为保留关键字 [英] How to find if a column name is a reserved keyword across various databases
问题描述
我们有一个具有以下列名的旧式模式文件,想了解如果将我们的应用程序移植到h2,mysql,postgres或oracle时是否会引起问题.
We have a legacy schema file which has the following column names, would like to understand if any of them would cause an issue if we port our application to h2, mysql, postgres or oracle.
例如,我如何知道是否可以在下面列出的数据库中使用它?有什么好的工具可以对此进行初步检查吗?
e.g how would I know if using this would be ok across the databases listed below. Are there any good tools which can do a preliminary check on this?
key
when
size
type
count
from
with
推荐答案
获得保留字列表并建立保留字表应该很容易.以下是一些保留字列表:
Should be quite easy to get the list of reserved words and build a table of the reserved words. Here are some lists of reserved words:
- Oracle: http://download.oracle .com/docs/cd/B19306_01/em.102/b40103/app_oracle_reserved_words.htm
- SQL Server:
http://msdn.microsoft.com/en-us/library/ms189822. aspx - PostgreSQL:
http://www.postgresql.org/docs/current/static/sql-keywords-appendix.html - MySQL:
https://dev.mysql. com/doc/refman/5.6/en/keywords.html#keywords-in-current-series
- Oracle: http://download.oracle.com/docs/cd/B19306_01/em.102/b40103/app_oracle_reserved_words.htm
- SQL Server:
http://msdn.microsoft.com/en-us/library/ms189822.aspx - PostgreSQL:
http://www.postgresql.org/docs/current/static/sql-keywords-appendix.html - MySQL:
https://dev.mysql.com/doc/refman/5.6/en/keywords.html#keywords-in-current-series
这是一个在线检查器: http://www.petefreitag.com/tools/sql_reserved_words_checker/?word = on
And here's an online checker: http://www.petefreitag.com/tools/sql_reserved_words_checker/?word=on
这篇关于如何在各种数据库中查找列名是否为保留关键字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!