Mssqlserver mathematical function example (1/2)

Source: Internet
Author: User
Tags mssql server mssqlserver
MSSQLSERVER2005 mathematical functions 1. evaluate absolute ABS () selectFWeight-50, ABS (FWeight-50), ABS (-5.38) fromT_Person2. POWER (X, Y) is used to calculate X's y power selectFWeight, POWER (FWeight,-0.5), POWER (FWeight, 2), POWER (FWe mssql server 2005 mathematical functions)
1. Absolute Value
ABS ()
Select FWeight-50, ABS (FWeight-50), ABS (-5.38) from T_Person
2. Power
POWER (X, Y) is used to calculate the y power of X.
Select FWeight, POWER (FWeight,-0.5), POWER (FWeight, 2 ),
POWER (FWeight, 3), POWER (FWeight, 4) from T_Person
Select Power (2, 2)
3. Square Root
SQRT ()
Select FWeight, SQRT (FWeight) from T_Person
4. Random Number Calculation
RAND () supports parameter or Parameter
Select RAND ()
Select RAND (123)
5. round to the maximum integer
CEILING ()
Select FName, FWeight, CEILING (FWeight), CEILING (FWeight *-1) from T_Person
6. round to the smallest integer
FLOOR ()
Select FName, FWeight, FLOOR (FWeight), FLOOR (FWeight *-1) from T_Person
7. Rounding
ROUND ()
ROUND (m, d) m is the value to be rounded to, and d is the calculation precision, that is, the number of decimal places reserved during rounding.
If d is 0, the decimal places are not retained. If d is negative, it is rounded to the integer.
Select FName, FWeight, ROUND (FWeight, 1), ROUND (FWeight *-1, 0), ROUND (FWeight,-1) from T_Person
8. Sine Value
SIN ()

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.