Finding Floor and Fraction of the Decimal Number

Finding Floor and Fraction of the Decimal Number

Today I presented a solution for a very common request - given a decimal number, find its floor (I am using this Wikipedia definition) as well as its fraction.  

This is the solution as appeared in that referenced thread:

DECLARE @amount MONEY;
 
SET @amount = 812.85;
 
SELECT @amount AS Amount
    ,CAST(floor(@amount) AS INT) AS [Whole portion]
    ,@amount % 1 AS [Decimal portion]

This can be used to print on a check, for example. This blog post by Kalman Toth presents a function that converts number to words.

See Also



This entry participated in the Technology Guru TechNet WiKi for May contest. 
Leave a Comment
  • Please add 3 and 6 and type the answer here:
  • Post
Wiki - Revision Comment List(Revision Comment)
Sort by: Published Date | Most Recent | Most Useful
Comments
  • Naomi  N edited Revision 9. Comment: Added See Also

  • Naomi  N edited Revision 8. Comment: tense

  • Naomi  N edited Revision 7. Comment: Added tag

  • Naomi  N edited Revision 6. Comment: Adjusted participation link

  • Naomi  N edited Revision 4. Comment: Added tags

  • Naomi  N edited Revision 3. Comment: Fixed last link

  • Naomi  N edited Revision 2. Comment: Adjusted link to Kalman's blog

  • Ed Price - MSFT edited Revision 1. Comment: Title casing, added tags

Page 1 of 1 (8 items)
Wikis - Comment List
Sort by: Published Date | Most Recent | Most Useful
Posting comments is temporarily disabled until 10:00am PST on Saturday, December 14th. Thank you for your patience.
Comments
  • Ed Price - MSFT edited Revision 1. Comment: Title casing, added tags

  • Naomi  N edited Revision 2. Comment: Adjusted link to Kalman's blog

  • Naomi  N edited Revision 3. Comment: Fixed last link

  • Naomi  N edited Revision 4. Comment: Added tags

  • Naomi  N edited Revision 6. Comment: Adjusted participation link

  • Naomi  N edited Revision 7. Comment: Added tag

  • Naomi  N edited Revision 8. Comment: tense

  • Naomi  N edited Revision 9. Comment: Added See Also

Page 1 of 1 (8 items)