INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

dropping a decimal from a field in TSQL

dropping a decimal from a field in TSQL

(OP)
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

RE: dropping a decimal from a field in TSQL

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

RE: dropping a decimal from a field in TSQL




Basically you would

Integer([your column]]*100)/100

however it is expressed in your SQL.

In Access...

INT([your column]]*100)/100

 

Skip,

glassesJust traded in my old subtlety...
for a NUANCE!tongue

RE: dropping a decimal from a field in TSQL

(OP)
I actually want to drop the third place.

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

RE: dropping a decimal from a field in TSQL



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

Skip,

glassesJust traded in my old subtlety...
for a NUANCE!tongue

RE: dropping a decimal from a field in TSQL

To actually update the data in the field, you should use an update query.

Duane
Hook'D on Access
MS Access MVP

RE: dropping a decimal from a field in TSQL

   

Quote:

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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close