Skip Navigation Links
Home
Articles
SQL Server 2012
SQL Server 2014
SQL Server 2016
FAQ
Forums
Practice Test
Bookstore
Tip of the Day : Convert Oracle Math Functions to SQL Server Math Functions
SQL Server Helper
Home > > Tip of the Day
SQL Server Helper - Tip of the Day

Function

Oracle

SQL Server

Convert Character to ASCII

ASCII(p)

ASCII(p)

Convert ASCII to Character

CHR(p)

CHAR(p)

Concatenate Strings

CONCAT(p1, p2)

p1 || p2

p1 + p2

Return Starting Point of Character in Character String

INSTR(p1, p2)

CHARINDEX(p2, p1)

Convert String to All Lower Case

LOWER(p1)

LOWER(p1)

Convert String to All Upper Case

UPPER(p1)

UPPER(p1)

Pad Left Side of Character String

LPAD(p1, p2, p3)

RIGHT(REPLICATE(p3, p2) + p1, p2)

Remove Leading Blank Spaces

LTRIM(p1)

LTRIM(p1)

Remove Trailing Blank Spaces

RTRIM(p1)

RTRIM(p1)

Return Starting Point of Pattern in Character String

INSTR(p1, p2)

PATINDEX(p2, p1)

Pad Right Side of Character String

RPAD(p1, p2, p3)

LEFT(p1 + REPLICATE(p3, p2), p2)

Phonetic Representation of Character String

SOUNDEX(p1)

SOUNDEX(p1)

Convert Numeric Data to String

TO_CHAR(p1)

CAST(p1 as VARCHAR)

Extract a Portion of a String from the Input String

SUBSTR(p1, p2, p3)

SUBSTRING(p1, p2, p3)

Replace Characters

REPLACE(p1, p2, p3)

REPLACE(p1, p2, p3)

Reverse String

REVERSE(p)

REVERSE(p)

Capitalize First Letter of Each Word in String

INITCAP(p1)

Not Available

Translate Character String

TRANSLATE(p1)

Not Available

Return Length of String

LENGTH(p)

LENGTH(p)

Return Length of String in Bytes

LENGTHB(p)

DATALENGTH(p)

Greatest Character String in List

GREATEST(p1, p2, …)

Not Available

Least Character String in List

LEAST(p1, p2, …)

Not Available

Replace String if NULL

NVL(p1, p2)

ISNULL(p1, p2)

Return NULL if both Expressions are the Same.

NULLIF(p1, p2)

NULLIF(p1, p2)

Back to Tip of the Day List Next Tip