cast 的用法

写了一个数据项:substring ([test_day_day].[时间].[时间].[Month].[Month - 全称],1,4)||substring ([test_day_day].[时间].[时间].[Month].[Month - 全称],6,2)能得到 比如 ’201206‘ 这样的字符串,但是在比较大小的时候字符串不好用。打算用cast 把上面的表达式,转换成...显示全部
写了一个数据项:substring ([test_day_day].[时间].[时间].[Month].[Month - 全称],1,4)||substring ([test_day_day].[时间].[时间].[Month].[Month - 全称],6,2)
能得到 比如 ’201206‘ 这样的字符串,但是在比较大小的时候字符串不好用。

打算用cast 把上面的表达式,转换成为数字型。

cast (substring ([test_day_day].[时间].[时间].[Month].[Month - 全称],1,4)||substring ([test_day_day].[时间].[时间].[Month].[Month - 全称],6,2),NUMERIC)

但是报错:

无标题11.jpg


请问大虾们,这是为什么,是cast用的不对吗 ? 怎么处理才是正确的呢 ?收起
参与10

查看其它 8 个回答suxiaoli的回答

suxiaolisuxiaoli商业智能工程师NCS
把NUMERIC换成integer试试呢?cast (substring ([test_day_day].[时间].[时间].[Month].[Month - 全称],1,4)||substring ([test_day_day].[时间].[时间].[Month].[Month - 全称],6,2),integer)
软件开发 · 2014-08-26
浏览1193

回答者

suxiaoli
商业智能工程师NCS

suxiaoli 最近回答过的问题

回答状态

  • 发布时间:2014-08-26
  • 关注会员:1 人
  • 回答浏览:1193
  • X社区推广