日期:2014-05-18  浏览次数:20530 次

float 转换为字符显示
一个表里的字段为float类型,值为-1.1的想查询后显示为字符:abc

(case col when -1.1 then 'abc' else col end) as col

这么写的话会提示:从数据类型 varchar 转换为 float 时出错.
有什么好的方法把float转换为字符吗?

------解决方案--------------------
SQL code
(case ltrim(col) when '-1.1' then 'abc' else ltrim(col) end) as col