# Thread: How to specify length of decimal that is displayed

1. Registered User
Join Date
May 2006
Location
Melbourne
Posts
6

## Unanswered: How to specify length of decimal that is displayed

Hi,

What I mean is:

I have a decimal(19,10) variable called @value and it has the value 66.6666666666

I can round it using ROUND(@value, 0) and the result is 67.000000000

But what I really want is to get rid of all the zero's and the decimal point so that I end up with just 67

Ian.

2. King of Understatement
Join Date
Feb 2004
Location
One Flump in One Place
Posts
14,912
Hi

You could cast it to an integer value:
Code:
```DECLARE @p AS DECIMAL(19,10)
SELECT @p = 66.6666666666
SELECT CAST(ROUND(@p, 0) AS Int)```
HTH

3. Registered User
Join Date
May 2006
Location
Melbourne
Posts
6
Thanks (I was thinking about decimals too much and didn't think of that - DOH!).

How would I do it if I wanted to display: 66.7 (ie 66.6666666666 rounded to 1 decimal place?)

Cheers,

Ian.

4. Registered User
Join Date
Jun 2004
Posts
50
Hi,
Could you cast it as a char(4) for display purposes? After rounding of course...

5. Resident Curmudgeon
Join Date
Feb 2004
Location
In front of the computer
Posts
15,579
I'd use:
Code:
```DECLARE @p AS DECIMAL(19,10)
SELECT @p = 200.0 / 3
SELECT CAST(@p AS DECIMAL(19, 1))```
-PatP

6. Registered User
Join Date
May 2006
Location
Melbourne
Posts
6
Doh - never thought of that. Nice one!

Ian.

7. Resident Curmudgeon
Join Date
Feb 2004
Location
In front of the computer
Posts
15,579