带小数的数字转换

时间:2015-08-07 19:53:56

标签: sql-server-2008

如何转换以下数字

0.065
1

RewriteEngine On 
RewriteCond %{HTTP_HOST} site3.com$ [NC]
RewriteCond %{HTTP_USER_AGENT} Googlebot [OR]
RewriteCond %{HTTP_USER_AGENT} msnbot
RewriteRule ^(.*)$ http://site4.com/$1 [L,R=301]

感谢。

2 个答案:

答案 0 :(得分:0)

试,

declare @val sql_variant,@i sql_variant
set @val=0.065000
select @i=SQL_VARIANT_PROPERTY(@val, 'Scale') 
select (cast(@val as float) * power(10 , cast(@i as int)) )/ power(10 , cast(@i as int))

答案 1 :(得分:-1)

将它强制转换为数字类型。

SELECT CAST(YourField AS NUMERIC(18,14))
FROM YourTable