Home All Groups Group Topic Archive Search About

Decimal Digits Lost When Using Decimal(9,2) Parameter

Author
1 Sep 2005 6:08 PM
joey.powell
Hello,

I am trying to use a decimal type parameter in my stored procedure.
When I pass any decimal value to it (for example: 12.34), the decimal
part is always truncated off. I am left with only 12 as the value that
get put into my table. I have checked the obvious...the datatype is
decimal in the procedure. The data type for the column is decimal(9,2)
in my table. Any idea about what is going on here?

Author
1 Sep 2005 6:12 PM
Aaron Bertrand [SQL Server MVP]
Can you show some code so we can repro/diagnose?



<joey.pow***@topscene.com> wrote in message
Show quote
news:1125598102.549921.46630@g47g2000cwa.googlegroups.com...
> Hello,
>
> I am trying to use a decimal type parameter in my stored procedure.
> When I pass any decimal value to it (for example: 12.34), the decimal
> part is always truncated off. I am left with only 12 as the value that
> get put into my table. I have checked the obvious...the datatype is
> decimal in the procedure. The data type for the column is decimal(9,2)
> in my table. Any idea about what is going on here?
>
Author
1 Sep 2005 6:39 PM
David Gugick
joey.pow***@topscene.com wrote:
> Hello,
>
> I am trying to use a decimal type parameter in my stored procedure.
> When I pass any decimal value to it (for example: 12.34), the decimal
> part is always truncated off. I am left with only 12 as the value that
> get put into my table. I have checked the obvious...the datatype is
> decimal in the procedure. The data type for the column is decimal(9,2)
> in my table. Any idea about what is going on here?

You are proably using the value in a calculation that includes an
integer data type. Make sure all operations use decimal as the data
type.

--
David Gugick
Quest Software
www.imceda.com
www.quest.com
Author
1 Sep 2005 8:38 PM
Steve Kass
Joey,

The datatype DECIMAL is shorthand for DECIMAL(18,0).  Change
the data type of the procedure parameter to DECIMAL(9,2).

Steve Kass
Drew University

joey.pow***@topscene.com wrote:

Show quote
>Hello,
>
>I am trying to use a decimal type parameter in my stored procedure.
>When I pass any decimal value to it (for example: 12.34), the decimal
>part is always truncated off. I am left with only 12 as the value that
>get put into my table. I have checked the obvious...the datatype is
>decimal in the procedure. The data type for the column is decimal(9,2)
>in my table. Any idea about what is going on here?
>

>

AddThis Social Bookmark Button