比如在sysbase表中定义的字段格式为:numeric(18,2)
值为:50000.00
现在要把数据导出,转换成固定格式,14位长,不足的补0,而且去掉小数点.
如:00000005000000
我现在用的语句是:
select right(repeat(0,14) || convert (numeric(18,2),Isnull(NomiAmt,0)), 14) from LtaSasBonds
结果为:000000050000.00
请问一下,如果让它不显示小数点啊??
急,谢谢各位,帮忙一下啦
------解决方案--------------------------------------------------------
select REPLACE(right(repeat(0,14) || convert (numeric(18,2),Isnull(5000.00,0)), 14) ,'.','')
------解决方案--------------------------------------------------------
select REPLACE(right(repeat(0,14) || convert (numeric(18,2),Isnull(50000.00 ,0)), 14) ,'.','')
因为你在转换时指定有2位小数,故有小数点
------解决方案--------------------------------------------------------
- SQL code
select REPLACE(right(repeat(0,14) || convert (numeric(18,2),Isnull(NomiAmt,0)), 14),'.','') from LtaSasBonds