SQL中类型转换后再求和怎么实现

来源:百度知道 编辑:UC知道 时间:2024/09/24 21:17:59
比如字段ID为char型,我要求和怎么实现.我用cas()转换后仍不能求和.求各位高手解我倒悬之急..

select sum(convert(int,id))+convert(int,asm_spec_price) from table
char 类型中不能有字符。。
呵呵,你自己检查

select sum(to_number(id)) from 表名

当然id中不能有字符类型

貌似用NVARCHAR也可以的