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 C# + ASP.NET + SQL Server 2008
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.
DECIMALthen you’re usingDECIMAL(18,0)–> up to 18 digits, but none after the decimal point. That would truncate 0.15 to 0. Just usingDECIMALas 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