March 16, 2014 at 7:18 pm
Hi Everyone,
I would like to 'drop' some trailing zeros from a decimal value, e.g.: 50.000000, and I am wondering how to go about this?
The value is definitely of decimal type, and in this instance I know that I want to eliminate exactly six (6) zeros.
Any help here will be greatly appreciated.
Kind Regards,
David
March 16, 2014 at 9:32 pm
Normally you should not care about trailing 0's. The front end worries about the display and making it pretty.
But if you have to, this should do it:
Select cast(100/2.0 as decimal(3))
__________________________________________________________________________________________________________
How to Post to get the most: http://www.sqlservercentral.com/articles/Best+Practices/61537/
March 16, 2014 at 10:46 pm
Thanks LinksUp
March 17, 2014 at 5:39 am
david.dartnell (3/16/2014)
Hi Everyone,I would like to 'drop' some trailing zeros from a decimal value, e.g.: 50.000000, and I am wondering how to go about this?
The value is definitely of decimal type, and in this instance I know that I want to eliminate exactly six (6) zeros.
Any help here will be greatly appreciated.
Kind Regards,
David
Cast the value to whichever of the integer datatypes is appropriate.
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
March 18, 2014 at 11:55 pm
Thanks for your responses.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply