将SQL查询出来的VARCHAR格式的8位数转换为yyyy-mm-dd格式 是db2数据库 用DbVisualizer8.0.8客户端
SELECTPROD_FOUND_DATEAS"beginDate",SCHEDULE_DUEDATE_SECONDAS"endDate"FROMHBTS.TTMXX20...
SELECT
PROD_FOUND_DATE AS "beginDate",
SCHEDULE_DUEDATE_SECOND AS "endDate"
FROM
HBTS.TTMXX20
WHERE
1=1 展开
PROD_FOUND_DATE AS "beginDate",
SCHEDULE_DUEDATE_SECOND AS "endDate"
FROM
HBTS.TTMXX20
WHERE
1=1 展开
2个回答
展开全部
SELECT
to_char(PROD_FOUND_DATE,'yyyy-mm-dd') AS "beginDate",
SCHEDULE_DUEDATE_SECOND AS "endDate"
FROM
HBTS.TTMXX20
WHERE
1=1
to_char(PROD_FOUND_DATE,'yyyy-mm-dd') AS "beginDate",
SCHEDULE_DUEDATE_SECOND AS "endDate"
FROM
HBTS.TTMXX20
WHERE
1=1
更多追问追答
追问
报这个错
DB2 SQL Error: SQLCODE=-180, SQLSTATE=22007, SQLERRMC=Invalid date/time value;SYSIBM.VARCHAR_FORMAT, DRIVER=3.57.82
追答
PROD_FOUND_DATE先把这个转换为date类型
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
SELECT
to_date(PROD_FOUND_DATE,'yyyy-mm-dd') AS "beginDate",
to_date(SCHEDULE_DUEDATE_SECOND,'yyyy-mm-dd') AS "endDate"
FROM
HBTS.TTMXX20
WHERE
1=1
to_date(PROD_FOUND_DATE,'yyyy-mm-dd') AS "beginDate",
to_date(SCHEDULE_DUEDATE_SECOND,'yyyy-mm-dd') AS "endDate"
FROM
HBTS.TTMXX20
WHERE
1=1
更多追问追答
追问
报错SQLCODE=-20448, SQLSTATE=22007, SQLERRMC= ;yyyy-mm-dd, DRIVER=3.57.82
追答
SELECT
to_date(PROD_FOUND_DATE,'yyyymmdd') AS "beginDate",
to_date(SCHEDULE_DUEDATE_SECOND,'yyyymmdd') AS "endDate"
FROM
HBTS.TTMXX20
WHERE
1=1
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询