Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dropping a decimal from a field in TSQL

Status
Not open for further replies.

MACTONI

Technical User
Aug 18, 2011
2
US
I have a column in my table name feeamount. I have numbers like 0.809, 0.734 and even 0.752.

What tsql statement do I run to remove the their decimal place so my number will appear in the table as 0.80, 0.73 and 0.75. In other works drop the third place.

THANKS FOR YOU HELP
 
Do you want to actually "drop" the precision or make it "appear" as if it is 2 decimal places. You have used both words in your question. Typically this should be asked in the SQL Server Programming forum.

Duane
Hook'D on Access
MS Access MVP
 



Basically you would
[tt]
Integer([your column]]*100)/100
[/tt]
however it is expressed in your SQL.

In Access...
[tt]
INT([your column]]*100)/100
[/tt]


Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
I actually want to drop the third place.

For example all number appear as .xxx would appear as .xx
 


That is what the formula does: truncates to 2 decimal places.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 

I have numbers like 0.809 [...] as 0.80

You may want to Round the number so you would get 0.81 (and not just 0.8), but you may not care about it. Depends on your requirements.

Have fun.

---- Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top