DB2数据库,时间类型插入数据
1、TIMESTAMP类型
1.1、创建表
CREATE TABLE BI_varchar (
id INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1 ),
hide_zero varchar(1000),
simulation_cphone_de varchar(1000),
disorder_de varchar(1000),
upfloat_de INTEGER,
downfloat_de INTEGER,
zero_de INTEGER,
sm3_de varchar(1000),
ip_prefix_de varchar(1000),
numerical_de INTEGER,
date_de TIMESTAMP,
mix_ph_de varchar(1000),
PRIMARY KEY (id)
)
1.2、时间类型TIMESTAMP插入数据
current timestamp
INSERT INTO db2inst1.BI_varchar(hide_zero,simulation_cphone_de,disorder_de,upfloat_de,downfloat_de,zero_de,sm3_de,ip_prefix_de,numerical_de,DATE_DE ,mix_ph_de) values (2345678,'010-68810345','123456789',500,500,381.11,'张三','10.1.1.196',28,current timestamp,'13789099800')
1.3、TIMESTAMP类型展示结果
2、date类型
insert into BI_varchar(DATE_DE)values(current date)
2、DB2创建表和插入语句
CREATE TABLE dee_varchar (
id INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1 ),
cover_de varchar(1000),
hide_de varchar(1000),
simulation_erd_de varchar(1000),
range_rd_de INTEGER,
simulation_re_de varchar(1000),
range_add_de INTEGER,
float_de INTEGER,
cutout_de varchar(1000),
cut_de varchar(1000),
ip_prefix_de varchar(1000),
composite_de varchar(1000),
mix_de varchar(1000),
disorder_de varchar(1000),
zero_de INTEGER,
sm3_de varchar(1000),
numerical_de INTEGER,
date_de varchar(1000),
cipher_de varchar(1000),
PRIMARY KEY (id)
)
INSERT INTO db2inst1.dee_varchar (cover_de,hide_de,simulation_erd_de,range_rd_de,simulation_re_de,range_add_de,float_de,cutout_de,cut_de,ip_prefix_de,composite_de,mix_de,disorder_de,zero_de,sm3_de,numerical_de,date_de,cipher_de) VALUES ('HMF','13569800','hmf@yahoo.com',500,'北京市',117,500,'北京安全网络技术有限公司','测试开发工程师','10.1.1.196','13516281600|010-68810345','13516281600','123456789',3811,'张三',28,'20190520 12:30:45','密文测试')
参考:数据库时间类型详解