Tip of the Day : Convert Oracle Math Functions to SQL Server Math Functions

Welcome to SQL Server Helper !!!

This site is intended for those who are beginning to use SQL Server as part of their day-to-day activities.  You will find in this site a collection of useful functions, triggers, stored procedures and tips and tricks related to SQL Server.

Should you have any comments or questions regarding this site or if you want to ask SQL Server-related questions, e-mail us here.

We hope we are able to help and we are glad to help!!!

SQL Server Tip of the Day - June 25, 2019

Convert Oracle Math Functions to SQL Server Math Functions

Function

Oracle

SQL Server

Absolute Value

ABS(p)

ABS(p)

Arc Cosine

ACOS(p)

ACOS(p)

Arc Sine

ASIN(p)

ASIN(p)

Arc Tangent

ATAN(p)

ATAN(p)

Arc Tangent of n and m

ATAN2(p1, p2)

ATN2(p1, p2)

Smallest Integer Greater Than or Equal to Input Value

CEIL(p)

CEILING(p)

Cosine

COS(p)

COS(p)

Hyperbolic Cosine

COSH(p)

COT(p)

E Raised to the nth Power

EXP(p)

EXP(p)

Largest Integer Value Less Than or Equal to Input Value

FLOOR(p)

FLOOR(p)

Natural Logarithm

LN(p)

LOG(p)

Logarithm of n Base m

LOG(m, n)

LOG(p1, p2)

Logarithm, Base 10

LOG(10, p)

LOG10(p)

Modulus

MOD(p1, p2)

p1 % p2

Power

POWER(p1, p2)

POWER(p1, p2)

Random Number

Not Applicable

RAND()

Remainder

REMAINDER(p1, p2)

Not Available

Round

ROUND(p1, p2)

ROUND(p1, p2)

Sign of Number

SIGN(p)

SIGN(p)

Sine

SIN(p)

SIN(p)

Hyberbolic Sine

SINH(p)

Not Available

Square Root

SQRT(p)

SQRT(p)

Tangent

TAN(p)

TAN(p)

Hyberbolic Tangent

TANH(p)

Not Available

Truncate

TRUNC(p1, p2)

ROUND(p1, p2, 1)

Greatest Value in a List of Expressions

GREATEST(p1, p2, …, pn)

Not Available

Smallest Value in a List of Expressions

LEAST(p1, p2, …, pn)

Not Available

Convert Number if NULL

NVL(p1, p2)

ISNULL(p1, p2)

SQL Server 2012

SQL Server 2008

User-Defined Functions

Date Functions

A collection of useful user-defined functions that deal with dates.

String Functions

A collection of useful user-defined functions that deal with strings (varchar/char/nvarchar/nchar).

Tree Functions

A collection of useful user-defined functions that deal with tree or hierarchical design structures.

Table-Valued Functions

A collection of useful table-valued user-defined functions that can be used to join with other tables.

SQL Server Built-in Functions

A reference to all built-in functions available within SQL Server grouped into categories.

Tips and Tricks

A collection of useful SQL Server-related tips and tricks:

SQL Server Error Messages

A list of SQL Server error messages and for certain error messages, discusses ways on how to solve the error or work around them:

Frequently Asked Questions