Question

Hello i have a PropertiesComboBox which i use for filtering and i am populating it using a stored procedure. However when the values are returned in the PropertiesComboBox, they are returned with extra 0's. It returns 3.0000 when i only want it to return 3.00

Here is my code for the stored procedure:

CREATE PROC GetPromoValueColumn @Platform varchar(30)
AS
BEGIN
    SELECT      p.Value
    FROM        PromotionalCode p
    JOIN        Application a
    ON          a.ID = p.AppID
    GROUP BY    p.Value
END

Any idea as to why this happens?

thanks.

Was it helpful?

Solution

p.Value is of a precision that would allow for values with 4 places after the decimal point.

Mathematically, 3, 3.0, 3.00, 3.000, 3.0000 and 3.00000 are the same value: 3.

It's entirely up to you to format it in a way that makes sense for your application.

OTHER TIPS

Probably you defined your PromotionalCode.p field as decimal(X,4)

X rapresent the total number of digits of your number, 4 is the number of decimal digits. If you try to redefine your table column as decimal(X,2) you will see only 2 decimals digits.

es:

ALTER TABLE PromotionalCode MODIFY COLUMN p DECIMAL(10,2) DEFAULT NULL;
declare @id decimal(16,3) 

you need to set the decimal values as per your requirement

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top