MSSQL SERVER 2005 数学函数整理
MSSQL SERVER 2005 数学函数整理
MSSQL SERVER 2005 数学函数1.求绝对值
ABS()
select FWeight-50,ABS(FWeight-50),ABS(-5.38) from T_Person
2.求幂
POWER(X,Y) 用来计算X的Y次幂
select FWeight,POWER(FWeight,-0.5),POWER(FWeight,2),
POWER(FWeight,3),POWER(FWeight,4) from T_Person
select Power(2,2)
3.求平方根
SQRT()
select FWeight,SQRT(FWeight) from T_Person
4. 求随机数
RAND() 支持有参数,也可以没参数
select RAND()
select RAND(123)
5.舍入到最大整数
CEILING()
select FName,FWeight,CEILING(FWeight),CEILING(FWeight*-1) from T_Person
6.舍入到最小整数
FLOOR()
select FName,FWeight,FLOOR(FWeight),FLOOR(FWeight*-1) from T_Person
7.四舍五入
ROUND()
ROUND(m,d) m为待进行四舍五入的数值,d为计算精度,也就是四舍五入时保留的小数位数
d为0表示不保留小数位,d为负值表示在整数部分进行四舍五入。
select FName,FWeight,ROUND(FWeight,1),ROUND(FWeight*-1,0),ROUND(FWeight,-1) from T_Person
8.求正弦值
SIN()
select FName,FWeight,SIN(FWeight)from T_Person
9.求余弦值
COS()
select FName,FWeight,COS(FWeight) from T_Person
10.求反正弦
ASIN()
select FName,FWeight,ASIN(1/FWeight) from T_Person
11.求反余弦
ACOS()
select FName,FWeight,ACOS(1/FWeight) from T_Person
12.求正切值
TAN()
select FName,FWeight,TAN(FWeight) from T_Person
13.求反正切值
ATAN()
select FName,FWeight,ATAN(FWeight) from T_Person
14.求两个变量的反正切
ATN2(X,Y) 类似于计算Y/X的反正切
select FName,FWeight,ATN2(Fweight,2) from T_Person
15.求余切
COT()
select FName,FWeight,COT(Fweight) from T_Person
16.求圆周率π值
PI()
select FName,FWeight,Fweight*PI(),PI() from T_Person
17.弧度制转换为角度制
DEGREES() 结果的精确度与参数有关
select DEGREES(PI()),DEGREES(3.0),DEGREES(3)
18.角度制转换为弧度制
RADIANS() 结果的精确度与参数有关
select RADIANS(180),RADIANS(180.0)
19.求符号
SIGN() 返回一个数值的符号,如果数值大于0则返回1,
如果数值等于0则返回0,如果数值小于0则返回-1.
结果的精确度与参数有关
select FName,FWeight-48.68,SIGN(FWeight-48.68),SIGN(1),SIGN(1.000) from T_Person
20.求整除余数 %
select FName,FWeight,FWeight%5 from T_Person
21.求自然对数
LOG()
select FName,FWeight,LOG(FWeight),LOG(1.00) from T_Person
22.求以10为底的对数
LOG10()
select FName,Fweight,LOG10(FWeight),LOG10(100) from T_Person
ps:
主要参照《程序员的SQL金典》
实例有所改动。
T_Person表的创建
代码如下:
create table T_Person
(
FIdNumber varchar(20),
FName varchar(20),
FBirthDay datetime,
FRegDay datetime,
FWeight numeric(10,2),
)

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Methods for php to connect to mssql database include using PHP's MSSQL extension, using PDO, etc. Detailed introduction: 1. Use PHP's MSSQL extension method to ensure that PHP has the MSSQL extension installed. You can check whether the mssql extension is enabled in the PHP configuration file (php.ini); 2. Use the PDO method to ensure that PHP has the PDO extension installed. You can check whether the pdo_sqlsrv extension is enabled in the PHP configuration file (php.ini).

Ubuntu is a popular open source operating system commonly used to run servers. Installing PHP and configuring MSSQL connections on Ubuntu is one of the operations that many developers and system administrators often need to do. This article will provide readers with a detailed guide, including the steps to install PHP, set up Apache, install MSSQLServer, etc., and attach specific code examples. Step 1: Install PHP and related extensions First, we need to install PHP and related extensions to support PHP connections

Detailed steps for installing PHP to support MSSQL database in Ubuntu environment. When developing web applications, you often encounter situations where you need to connect to the Microsoft SQL Server (MSSQL) database. In the Ubuntu environment, to connect PHP to the MSSQL database, you need to install relevant software and configure appropriate settings. Next, we will introduce in detail the steps to install PHP to support MSSQL database in Ubuntu environment and provide specific code.

Installing PHP and connecting to MSSQL database under the Ubuntu operating system is one of the skills that many developers and system administrators need to master. This article will provide a detailed tutorial, including installing PHP, installing the MSSQL server driver, configuring PHP to connect to the MSSQL database, and providing corresponding code examples. Part One: Install PHP First, we need to install PHP and related extensions to be able to connect to the MSSQL database. Enter the following command in the terminal to install PHP and necessary extensions

Go is a simple, fast, safe, statically typed programming language suitable for developing large-scale applications. It has many built-in mathematical functions that make data processing and specific calculations much more convenient. This article will introduce how to use mathematical functions in Go language. We will cover the most basic mathematical functions such as addition, subtraction, multiplication, division, remainder, exponents, and logarithms, and also discuss advanced mathematical functions available in the Go standard library, such as trigonometric and hyperbolic functions. Before starting, you need to understand some basic Go language knowledge.

Information collection: The site is built using vue+aspx+iis8.5. The site login box has a version number and the word siteserver exists in the URL column, so it is suspected that it was built by cms, but I have not seen the cms. Using Google search, I found that the site was built with siteserver cms, the version is the latest, and the vulnerability provided on the Internet is This cannot be used. I tried injection + weak password + verification code bypass + unauthorized and other methods in the login box to no avail. Since I have a test account, I simply log in to the site directly for testing. The picture is the login picture I found online. The red box was the version number instead of the cms prompt. Functional test: After entering the background, I briefly browsed the functions, mostly for page management.

How to install php mssql on ubuntu: 1. Enter the terminal command window; 2. Execute "curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list > /etc/apt/sources.list.d/ mssql-release.list"; 3. Install "pdo_sqlsrv" through the install command.

For some time, ESET researchers have been tracking the activities of Winnti, a group that has been active since 2012 and has targeted the video game and software industry supply chains. Recently, a previously undocumented backdoor was discovered that targets Microsoft SQL (MSSQL). This backdoor bears many similarities to the PortReuse backdoor, another tool used by WinntiGroup and first documented in October 2019. This year, a new backdoor sample, skip-2.0, was detected. The author is a member of the winnti organization. This backdoor targets MSSQL Server 11 and 12 and allows attackers to use magi
