4

Assume i have the following decimal value:

4.584406

I need a simple quick way to truncate the decimal without rounding up, so the output would be 4.5

I'm using T-SQL (SQL Server 2005/2008).

Any help will be appreciated.

0

1 Answer 1

8

using the round function you can try this

select round(4.584406, 1, 1)

the output will be

4.5

the key is the third parameter

ROUND ( numeric_expression , length [ ,function ] )

function

Is the type of operation to perform. function must be tinyint,

smallint, or int. When function is omitted or has a value of 0 (default), numeric_expression is rounded. When a value other than 0 is specified, numeric_expression is truncated.

Not the answer you're looking for? Browse other questions tagged or ask your own question.