为提高效率,提问时请提供以下信息,问题描述清晰可优先响应。 【DM版本】:dm8 【操作系统】:liunx 【CPU】: 【问题描述】*:TIMESTAMP(6)的字段在迁移至达梦数据库时,应该使用哪个函数?使用DATE FORMAT’%Y-%m-%d %H:%i:%s.%f’显示无效的时间日期格式
达梦数据库是支持TIMESTAMP(6)字段类型的, 测试过程如下: create table test_date(C1 TIMESTAMP(6)); INSERT INTO test_date VALUES(TIMESTAMP ‘2022-10-11 09:10:21’); INSERT INTO test_date VALUES(TIMESTAMP ‘2022-10-11 10:10:21’); INSERT INTO test_date VALUES(TIMESTAMP ‘2022-10-11 11:10:21’); INSERT INTO test_date VALUES(TIMESTAMP ‘2022-10-11 12:10:21’); commit; select date_format(C1,‘%Y-%m-%d %H:%i:%s.%f’) from test_date;
SQL> select date_format(C1,‘%Y-%m-%d %H:%i:%s.%f’) from test_date;
行号 DATE_FORMAT(C1,‘%Y-%m-%d%H:%i:%s.%f’)
1 2022-10-11 09:10:21.000000 2 2022-10-11 10:10:21.000000 3 2022-10-11 11:10:21.000000 4 2022-10-11 12:10:21.000000
已用时间: 0.832(毫秒). 执行号:2310. SQL>
达梦数据库是支持TIMESTAMP(6)字段类型的,

测试过程如下:
create table test_date(C1 TIMESTAMP(6));
INSERT INTO test_date VALUES(TIMESTAMP ‘2022-10-11 09:10:21’);
INSERT INTO test_date VALUES(TIMESTAMP ‘2022-10-11 10:10:21’);
INSERT INTO test_date VALUES(TIMESTAMP ‘2022-10-11 11:10:21’);
INSERT INTO test_date VALUES(TIMESTAMP ‘2022-10-11 12:10:21’);
commit;
select date_format(C1,‘%Y-%m-%d %H:%i:%s.%f’) from test_date;
SQL> select date_format(C1,‘%Y-%m-%d %H:%i:%s.%f’) from test_date;
行号 DATE_FORMAT(C1,‘%Y-%m-%d%H:%i:%s.%f’)
1 2022-10-11 09:10:21.000000
2 2022-10-11 10:10:21.000000
3 2022-10-11 11:10:21.000000
4 2022-10-11 12:10:21.000000
已用时间: 0.832(毫秒). 执行号:2310.
SQL>