What's the easiest way to always round a number down in SQL Server 2005?

sql-server-2005, t-sql

Solution

Rounding down to a specific decimal place is the same as truncating to a decimal place... and you can use `round()` to do this:

select round(123.456789, 4, 1)

Returns:

123.456700

Problem

I can't seem to find this anywhere, but what is the correct way to always round a number down, to a specific decimal precision, using SQL Server 2005? Will I need to write my own function or is there already a function that does this? I do know that SQL Server 2008 R2 has a `ROUNDDOWN` function, and it does exactly what I need. Does a similar function exist in 2005?

Original source