我用的是ASA8.0数据库,统计数据我用了这样一个查询:
select count(*) from grxxb1
where xzbm like '5%' and convert(int,substr(csny,1,2))>49
但系统总是报错:ASA Error -157:Cannto convert 9* to a int
如果不用count(*)只用*,这条查询命令是可以执行的!grxxb1是一个个人信息表。xzbm和csny为表字段。
------解决方案--------------------
系统提示表明显呀,你的csny有字段的值为9*...,的通过substr(csny,1,2)后截取为9*,转换substr失败的;
count(*)是因为要查询所有的记录,而你的的其他SQL是因为为查到csny为9*开头的