【问题标题】:Drop table that has the name in lower case from the command line从命令行删除名称为小写的表
【发布时间】:2016-06-22 21:04:52
【问题描述】:

我需要删除一个具有小写名称的表,即academy

但是,当我执行 db2 drop table academydb2 drop table "academy" 时,我得到:

DB21034E  The command was processed as an SQL statement because it was not a 
valid Command Line Processor command.  During SQL processing it returned:
SQL0204N  "DB2INST1.ACADEMY" is an undefined name.  SQLSTATE=42704

同样的命令也适用于大写的表名。

当我列出我的表时,我有> db2 LIST TABLES

Table/View                      Schema          Type  Creation time             
------------------------------- --------------- ----- --------------------------
AA                              DB2INST1        T     2016-06-07-14.23.08.927146
MYNEWTABLE                      DB2INST1        T     2016-06-07-14.29.50.859806
academy                         DB2INST1        T     2016-06-07-17.05.27.510905

【问题讨论】:

  • 好像进入命令行处理器后,bug消失,drop table "academy" 返回DB20000I The SQL command completed successfully.

标签: db2 case-sensitive database-administration db2-luw


【解决方案1】:

db2 drop table "academy" 中的引号被 shell 吞噬。你需要避开它们:

db2 drop table \"academy\" 

或引用整个声明:

db2 'drop table "academy"'

【讨论】:

    【解决方案2】:

    尝试从“学院”中选择 *,看看它是否会调用该表。如果是这样,您应该能够再次运行相同的查询,只需将单词“select”替换为“drop”即可。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-07-11
      • 2011-03-31
      相关资源
      最近更新 更多