from front end application I am sending the value as 0.15 to database via a stored procedure, but it gets stored as 0 value. Why? please guide. I am using开发者_如何学JAVA C# + ASP.NET + SQL Server 2008
What datatype does the column have that you store it into? Also: what datatype does the parameter of the stored procedure have that you use to pass in that value??
My hunch: if you use e.g. DECIMAL
then you're using DECIMAL(18,0)
--> up to 18 digits, but none after the decimal point. That would truncate 0.15 to 0. Just using DECIMAL
as a data type doesn't automatically make it support after-decimal-point digits (a common mistake a lot of SQL programmers make - once - and then they know it).
Make sure both the parameter of the stored proc and the column in the table allow for fractional values, e.g. are something like DECIMAL(18,4)
or something like that
I'm pretty sure somewhere in your code your having an int / integer and this is where it get rounded to 0
精彩评论