2008-02-20 16:09:14
/ IBM数据库产品
db2中3种从日期(yyyy-mm-dd)格式转换成字符串(yyyymm)格式的方法即:从date('2008-01-01') 转成'200712'1。values(replace(left(cast(DATE(date('2008-01-01') -1 months) as varchar(10)),7),'-',''));------2007122。values left((char(integer(date('2008-01-01') -1 months))),6);------2007123。values(cast(YEAR(date('2008-01-01') -1 months) as char(4))||(case when(MONTH(date('2008-01-01') -1 months)>=10) then cast((MONTH(date('2008-01-01') -1 months)) as char(2))
查看(474)
评论(2)