Page 1 of 1

Rounding decimal values

Posted: Wed Nov 07, 2007 5:10 am
by ag_ram
Hi Folks

Source is a decimal(17,4) target is Varchar(50) . values in the decimal input can be negative . In the target leading '0' to be trimmed and 2 decimals are needed after point(.).

For positive integers TRIM does the trick , but stuck up with negative decimals(since start char is a '-' sign) TRIM would not work .

Suggestions appreciated!

Posted: Wed Nov 07, 2007 5:39 am
by balajisr
Can you post your derivation?

Ideally you should be using DecimalToString() with "supress_zero" option. You need not use trim().

What is your rtype when you round the decimal from scale of 4 to 2?