SQL Syntax differences between Oracle and MS-SQL
Here is a great reference page that shows the syntax differences between Oracle SQL and
Microsoft SQL Server SQL syntax:
http://www.bristle.com/Tips/SQL.htm#Differences%20Between%20Oracle%20and
%20MS%20SQL%20Server
There is also a great comparison page on SQL built-in functions in Oracle and SQL
Server:
http://www.bristle.com/Tips/SQL.htm#Differences%20in%20Built-In%20Functions
Description Oracle MS SQL Server
Smallest integer >= n CEIL CEILING
Modulus MOD %
Truncate number TRUNC <none>
Max or min number or string GREATEST,
<none>
in list LEAST
Translate NULL to n NVL ISNULL
Return NULL if two values
DECODE NULLIF
are equal
String concatenation CONCAT(str1,str2) str1 + str2
Convert ASCII to char CHR CHAR
Capitalize first letters of words INITCAP <none>
Find string in string INSTR CHARINDEX
Find pattern in string INSTR PATINDEX
String length LENGTH DATALENGTH
LPAD,
Pad string with blanks <none>
RPAD
Trim leading or trailing chars LTRIM(str,chars),
<none>
other than blanks RTRIM(str,chars)
Replace chars in string REPLACE STUFF
Convert number to string TO_CHAR STR, CAST
Convert string to number TO_NUMBER CAST
Get substring from string SUBSTR SUBSTRING
Char for char translation in
TRANSLATE <none>
string
Date addition ADD_MONTH or + DATEADD
Date subtraction MONTHS_BETWEEN or - DATEDIFF
Last day of month LAST_DAY <none>
Time zone conversion NEW_TIME <none>
Next specified weekday after
NEXT_DAY <none>
date
DATENAME,
Convert date to string TO_CHAR
CONVERT
Convert string to date TO_DATE CAST
Convert date to number TO_NUMBER(TO_CHAR(d)) DATEPART
Date round ROUND CONVERT
Date truncate TRUNC CONVERT
Current date SYSDATE GETDATE
Convert hex to binary HEXTORAW CAST
Convert binary to hex RAWTOHEX CONVERT
CASE ... WHEN
If statement in an expression DECODE
or COALESCE
User's login id number or SUSER_ID,
UID, USER
name SUSER_NAME
User's database id number or USER_ID,
UID, USER
name USR_NAME
Current user USER USER