Skip to Content
0
Former Member
Sep 10, 2010 at 06:41 AM

Query converted Numeric value in two decimal

1734 Views

Hi Experts,

i find that, if we display numeric data from SAP table, it is displayed as the value is,

but if we display a numeric field from our internal/temporary table, it is automatically

rounded off to nearest 2 decimal places & displayed.

e.g. value 22.687 is displayed as 22.69

i tried following functions to display the value with 3 decimals

round(T1.[Qty],3)

cast(T1.[Qty] as decimal(16,3))

convert(decimal(16,3), T1.[Qty])

but none of the above functions worked. the value is still displayed as 22.69

then i tried the function cast(T1.[Qty] as varchar(16))

this worked, the value correctly displayed as 22.687 now

but the problem is the value is displayed left aligned just like any other VARCHAR value.

is there any way to display the value correctly & displayed right aligned like numeric data?

OR

is there any "SET" command to switch off this SQL's automatic rounding off to nearest 2 decimals?

OR

is there any "SET" command to forcefully display numeric fields as they are declared?

so that, we do not have to use cast, convert for every numeric field with more than 2 decimal places.

with warm Regards,