cast(cast(round(9.7999999999999997E-3, 6) as float) as varchar(20))
解决方案 »
- 请高手帮忙,关于SQL的递归查询
- 高手帮帮忙sql!!!!!!
- 求一SQL语句或者其他的解决方法,急!!!
- 求一SQL语句!试了很久没成功!请大家教教我
- 请教,这个SQL语句应该怎么写?
- 请教一个安全问题?sql停止服务后,如何让mdf被拷走后也不能附加?
- 为什么别人连不上我的SQLServer2000数据库了
- [高手] 这条sql 触发器怎么写?
- 什么情况下发以下SQL的WHERE不会执行并有结果返回
- 请问oracle中怎么同时进行左连接和右连接?
- 我动态构造某有40多个字段的表的所有字段的赋值给类型为nvarchar(4000)的字段,但是系统会自动截断!但是40多个字段美元可能超出4000的啊
- 土问,索引啥用
cast(cast(round(9.7999999999999997E-3, 6) as real) as varchar(20))
cast(round(9.7999999999999997E-3, 6) as real)cast(round(9.7999999999999997E-3, 6) as float)
cast(round(6.9999999999999994E-5, 6) as float)
这样的方法,对0.00...这样的数,当紧接小数点后面的0的个数>=4是就会以科学计数法显示,我看你还是写函数吧,
首先转换为numeric(20, 6),再转换为字符,然后去掉尾部的0
create formatfloat(@num float)
returns varchar(50)
as
begin
declare @s varchar(50)
set @s = cast(cast(round(@num, 6) as numeric(20, 6)) as varchar(50))
while charindex('0', @s, len(@s)) = len(@s)
set @s = left(@s, len(@s) - 1)
return @s
end