为什么2.5在sql中转换为3? [英] why 2.5 is converting to 3 in sql ?

查看:99
本文介绍了为什么2.5在sql中转换为3?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我传递值2.5为十进制时,它转换为3然后插入到表中..



如何在sql表中准确插入2.5

when i'm passing value 2.5 as decimal its getting converted to 3 and then getting inserted in to table..

How to insert exactly 2.5 in sql table

推荐答案

问题可能出在表结构或存储过程中,请检查表结构和插入该值的列的数据类型。 />
如果这是正确的,请检查存储过程变量数据类型。

数据类型可以作为Int。
The problem might be with the table structure or the stored procedure, check your table structure and the datatype of the column in which you are inserting that value.
If this is correct then check your stored procedure variable datatype.
The datatype may taken as Int.


请指定是否保留了小数/数字,是否允许分数。

ie

数字(10,2)

十进制(5,2)

将允许小数点后2位数
please specify whether you have kept decimal/number with fraction allowed or not.
i.e.
numeric(10,2)
decimal(5,2)
will allow 2 digits after decimal points


if you want the exact 2.5 ,then pass the  value  as float
,do not pass as Decimal ,int


这篇关于为什么2.5在sql中转换为3?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆