db2 load 自增测试

[db2inst1@db2 ~]$ db2 "create table admin.xpf (id int generated always as identity (start with 1 increment by 1 no cache nocycle),name varchar(20),address varchar(20),phonenum char(11))"
DB20000I  The SQL command completed successfully.
[db2inst1@db2 ~]$ db2 "insert into admin.xpf(name,address,phonenum) values ('xpf','hbyx','18618196076')"
DB20000I  The SQL command completed successfully.
[db2inst1@db2 ~]$ db2 set current schema admin
DB20000I  The SQL command completed successfully.
[db2inst1@db2 ~]$ db2 "select * from xpf"


ID          NAME                 ADDRESS              PHONENUM   
----------- -------------------- -------------------- -----------
          1 xpf                  hbyx                 18618196076


  1 record(s) selected.


[db2inst1@db2 ~]$ db2 "insert into xpf values(9,'linda','usa','13131231234')"
DB21034E  The command was processed as an SQL statement because it was not a 
valid Command Line Processor command.  During SQL processing it returned:
SQL0798N  A value cannot be specified for column "ID" which is defined as 
GENERATED ALWAYS.  SQLSTATE=428C9
[db2inst1@db2 ~]$ db2 "insert into xpf(name,address,phonenum) values('linda','usa','13131231234')"
DB20000I  The SQL command completed successfully.
[db2inst1@db2 ~]$ db2 "select * from xpf"


ID          NAME                 ADDRESS              PHONENUM   
----------- -------------------- -------------------- -----------
          1 xpf                  hbyx                 18618196076
          2 linda                usa                  13131231234


  2 record(s) selected.

[db2inst1@db2 ~]$ cat 1.del 
10,'james','lakes','110'
90,'katte','aus','119'


[db2inst1@db2 ~]$ db2 "load from 1.del of del modified by identityoverride insert into admin.xpf"
SQL3551W  The table contains at least one GENERATED ALWAYS column that the 
utility will override.


SQL3109N  The utility is beginning to load data from file 
"/db2home/db2inst1/1.del".


SQL3500W  The utility is beginning the "LOAD" phase at time "12/27/2016 
22:32:09.928256".


SQL3519W  Begin Load Consistency Point. Input record count = "0".


SQL3520W  Load Consistency Point was successful.


SQL3110N  The utility has completed processing.  "2" rows were read from the 
input file.


SQL3519W  Begin Load Consistency Point. Input record count = "2".


SQL3520W  Load Consistency Point was successful.


SQL3515W  The utility has finished the "LOAD" phase at time "12/27/2016 
22:32:10.052981".




Number of rows read         = 2
Number of rows skipped      = 0
Number of rows loaded       = 2
Number of rows rejected     = 0
Number of rows deleted      = 0
Number of rows committed    = 2


[db2inst1@db2 ~]$ db2 "select * from xpf"


ID          NAME                 ADDRESS              PHONENUM   
----------- -------------------- -------------------- -----------
          1 xpf                  hbyx                 18618196076
          2 linda                usa                  13131231234
         10 'james'              'lakes'              '110'      
         90 'katte'              'aus'                '119'      


  4 record(s) selected.


[db2inst1@db2 ~]$ db2 "load from 1.del of del modified by identitymissing insert into admin.xpf"
SQL3109N  The utility is beginning to load data from file 
"/db2home/db2inst1/1.del".


SQL3500W  The utility is beginning the "LOAD" phase at time "12/27/2016 
22:32:27.512231".


SQL3519W  Begin Load Consistency Point. Input record count = "0".


SQL3520W  Load Consistency Point was successful.


SQL3110N  The utility has completed processing.  "2" rows were read from the 
input file.


SQL3519W  Begin Load Consistency Point. Input record count = "2".


SQL3520W  Load Consistency Point was successful.


SQL3515W  The utility has finished the "LOAD" phase at time "12/27/2016 
22:32:27.755237".




Number of rows read         = 2
Number of rows skipped      = 0
Number of rows loaded       = 2
Number of rows rejected     = 0
Number of rows deleted      = 0
Number of rows committed    = 2


[db2inst1@db2 ~]$ db2 "select * from xpf"


ID          NAME                 ADDRESS              PHONENUM   
----------- -------------------- -------------------- -----------
          1 xpf                  hbyx                 18618196076
          2 linda                usa                  13131231234
         10 'james'              'lakes'              '110'      
         90 'katte'              'aus'                '119'      
          3 10                   'james'              'lakes'    
          4 90                   'katte'              'aus'      


  6 record(s) selected.


[db2inst1@db2 ~]$ db2 "load from 1.del of del modified by identityignore insert into admin.xpf"
SQL3109N  The utility is beginning to load data from file 
"/db2home/db2inst1/1.del".


SQL3500W  The utility is beginning the "LOAD" phase at time "12/27/2016 
22:33:47.293690".


SQL3519W  Begin Load Consistency Point. Input record count = "0".


SQL3520W  Load Consistency Point was successful.


SQL3110N  The utility has completed processing.  "2" rows were read from the 
input file.


SQL3519W  Begin Load Consistency Point. Input record count = "2".


SQL3520W  Load Consistency Point was successful.


SQL3515W  The utility has finished the "LOAD" phase at time "12/27/2016 
22:33:47.399742".




Number of rows read         = 2
Number of rows skipped      = 0
Number of rows loaded       = 2
Number of rows rejected     = 0
Number of rows deleted      = 0
Number of rows committed    = 2


[db2inst1@db2 ~]$ db2 "select * from xpf"


ID          NAME                 ADDRESS              PHONENUM   
----------- -------------------- -------------------- -----------
          1 xpf                  hbyx                 18618196076
          2 linda                usa                  13131231234
         10 'james'              'lakes'              '110'      
         90 'katte'              'aus'                '119'      
          3 10                   'james'              'lakes'    
          4 90                   'katte'              'aus'      
          5 'james'              'lakes'              '110'      
          6 'katte'              'aus'                '119'      


  8 record(s) selected.

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26224914/viewspace-2131454/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/26224914/viewspace-2131454/

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值