DB2中表名大小写

DB2中表名是分大小写的,如果创建表的时候,指定的是小写,那么DB2会自动转化为大写 


下面示例中,创建表的时候,都是“小写”,但第一个表被转换为了大写:

db2 => create table lowercaseone(id int)
DB20000I  The SQL command completed successfully.

db2 => create table "lowercasetwo"(id int)
DB20000I  The SQL command completed successfully.

db2 => list tables

Table/View                      Schema          Type  Creation time             
------------------------------- --------------- ----- --------------------------
LOWERCASEONE                    E105Q5A         T     2017-03-13-11.17.19.338368
lowercasetwo                    E105Q5A         T     2017-03-13-11.17.45.270534

  2 record(s) selected.

如果想要访问这些小写名的表,必须要用双引号把表名括上。如果不在DB2交互模式下,引号前面可以加上转义符\

$ db2 "insert into lowercasetwo values(100)"
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  "E105Q5A.LOWERCASETWO" is an undefined name.  SQLSTATE=42704

$ db2 "insert into \"lowercasetwo\" values(100)"
DB20000I  The SQL command completed successfully.

$ db2
(c) Copyright IBM Corporation 1993,2007
Command Line Processor for DB2 Client 10.5.5

To exit db2 interactive mode, type QUIT at the command prompt. Outside 
interactive mode, all commands must be prefixed with 'db2'.
To list the current command option settings, type LIST COMMAND OPTIONS.

For more detailed help, refer to the Online Reference Manual.

db2 => select * from "lowercasetwo"

ID         
-----------
        100

  1 record(s) selected.


参考资料:

https://www-01.ibm.com/support/docview.wss?uid=swg21459214

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值