richs
richs

Reputation: 4769

sybase format results to 4 decimal places

In sybase, how do you format the result from a select statement for a numeric field, to have no commas and 4 decimal digits.

For Example:

344,500.39495 = 344500.3949

492,930,948.39 = 492930948.3900

Upvotes: 1

Views: 23314

Answers (2)

Achow
Achow

Reputation: 8678

You could use ROUND ( numeric-expression, integer-expression )

numeric-expression : The number, passed to the function, to be rounded.

integer-expression : A positive integer specifies the number of significant digits to the right of the decimal point at which to round. A negative expression specifies the number of significant digits to the left of the decimal point at which to round.

Upvotes: 2

AbsoleteMe
AbsoleteMe

Reputation: 273

You can convert and format a number or a float to string with the str() function. The second parameter is the total length of the number, including the decimal point, and the third parameter is the length after decimal point.

str(yourDecimalNumber, 20, 4)

Upvotes: 5

Related Questions