views:

58

answers:

1

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.

+4  A: 

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.

RRUZ